Problem: You are given a circular array with n elements. The elements are numbered from some element with values from 1 to n in clockwise order. The i-th cell contains the value ai. The robot Simba is in cell s.

Each moment of time the robot is in some of the n cells (at the begin he is in s). In one turn the robot can write out the number written in current cell or move to the adjacent cell in clockwise or counterclockwise direction. To write out the number from the cell Simba doesn't spend any time, but to move to adjacent cell Simba spends one unit of time.

Simba wants to write the number from each cell one time, so the numbers will be written in a non decreasing order. Find the least number of time units to write out all numbers.

Input

The first line contains two integers n and s (1 ≤ s ≤ n ≤ 2000) — the number of cells in the circular array and the starting position of Simba.

The second line contains n integers ai ( - 109 ≤ ai ≤ 109) — the number written in the i-th cell. The numbers are given for cells in order from 1 to n. Some of numbers ai can be equal.

Output

In the first line print the number t — the least number of time units.

Each of the next n lines should contain the direction of robot movement and the number of cells to move in that direction. After that movement the robot writes out the number from the cell in which it turns out. The direction and the number of cells should be printed in the form of +x in case of clockwise movement and -x in case of counterclockwise movement to x cells (0 ≤ x ≤ n - 1).

Note that the sum of absolute values of x should be equal to t.

Examples

Input

9 1
0 1 2 2 2 1 0 1 1


Output

12
+0
-3
-1
+2
+1
+2
+1
+1
+1


Input

8 1
0 1 0 1 0 1 0 1


Output

13
+0
+2
+2
+2
-1
+2
+2
+2


Input

8 1
1 2 3 4 5 6 7 8


Output

7
+0
+1
+1
+1
+1
+1
+1
+1


Input

8 1
0 0 0 0 0 0 0 0


Output

7
+0
+1
+1
+1
+1
+1
+1
+1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
template <class T>
using vec = std::vector<T>;
template <class T>
using vec2d = std::vector<std::vector<T>>;
bool __hack = std::ios::sync_with_stdio(false);
auto __hack1 = cin.tie(nullptr);
struct Input {
  Input(istream& in) : in(&in) {}
  template <class T>
  T next() const {
    T x;
    *in >> x;
    return x;
  }
  int ni() const { return next<int>(); }
  template <class T>
  vec<T> nVec(int n) const {
    vec<T> v(n);
    for (int i = 0; i < n; ++i) {
      v[i] = next<T>();
    }
    return v;
  }
  vec<int> nvi(int n) const { return nVec<int>(n); }
  istream* in;
};
Input in(cin);
class Output {
 private:
  ostream* out;
  template <typename T>
  void printSingle(const T& value) {
    *out << value;
  }

 public:
  Output(ostream& out) : out(&out) {}
  inline void print() {}
  template <typename T, typename... Ts>
  inline void print(const T& f, const Ts&... args) {
    printSingle(f);
    if (sizeof...(args) != 0) {
      *out << ' ';
      print(args...);
    }
  }
  template <typename... Ts>
  inline void println(const Ts&... args) {
    print(args...);
    (*out) << '\n';
  }
  template <typename... Ts>
  inline void operator()(const Ts&... args) {
    println(args...);
  }
  template <typename T>
  ostream& operator<<(const T& x) {
    *out << x;
    return *out;
  }
};
Output out(cout);
namespace template_util {
constexpr int bytecount(uint64_t x) { return x ? 1 + bytecount(x >> 8) : 0; }
template <int N>
struct bytetype {};
template <uint64_t N>
struct minimal_uint : bytetype<bytecount(N)> {};
}  // namespace template_util
template <typename T>
class Compress {
 public:
  Compress(const vec<T>& o) : mapping(o), compressedOriginal(o) {
    sort(mapping.begin(), mapping.end());
    mapping.resize(unique(mapping.begin(), mapping.end()) - mapping.begin());
    for (int i = 0; i < (compressedOriginal.size()); ++i) {
      compressedOriginal[i] = int(
          lower_bound(mapping.begin(), mapping.end(), compressedOriginal[i]) -
          mapping.begin());
    }
  }
  int getSize() const { return static_cast<int>(mapping.size()); }
  vec<int> compressed() const { return compressedOriginal; }

 private:
  vec<int> mapping;
  vec<int> compressedOriginal;
};
void solve(istream& inStream, ostream& outStream) {
  in = Input(inStream);
  out = Output(outStream);
  auto n = in.ni();
  auto s = in.ni() - 1;
  auto a = in.nvi(n);
  Compress<int> compress(a);
  a = compress.compressed();
  auto maxValue = compress.getSize();
  vec2d<int> positions(maxValue);
  for (int i = 0; i < (n); ++i) {
    positions[a[i]].push_back(i);
  }
  const int INF = numeric_limits<int>::max() / 2;
  vec<int> deltaMoves;
  auto moveLeft = [&](int x, int y, vec<int>& deltas) -> int {
    if (y < x) {
      deltas.push_back(y - x);
      return x - y;
    } else {
      int dst = n - (y - x);
      deltas.push_back(-dst);
      return dst;
    }
  };
  auto moveRight = [&](int x, int y, vec<int>& deltas) -> int {
    if (y < x) {
      int dst = n - (x - y);
      deltas.push_back(dst);
      return dst;
    } else {
      deltas.push_back(y - x);
      return y - x;
    }
  };
  auto calcTravel = [&](int x, int row, int id) -> int {
    int y = positions[row][id];
    int dst = INF;
    vec<int> deltas;
    auto relax = [&](int cur) {
      if (cur < dst) {
        dst = cur;
        deltaMoves = deltas;
      }
      deltas.clear();
    };
    if (positions[row].size() == 1) {
      int cur = moveLeft(x, positions[row][id], deltas);
      relax(cur);
      cur = moveRight(x, positions[row][id], deltas);
      relax(cur);
    } else {
      int prev = positions[row][(id - 1 + positions[row].size()) %
                                positions[row].size()];
      int next = positions[row][(id + 1) % positions[row].size()];
      int cur = moveLeft(x, next, deltas);
      cur += moveRight(next, y, deltas);
      relax(cur);
      cur = moveRight(x, prev, deltas);
      cur += moveLeft(prev, y, deltas);
      relax(cur);
      if (y < x && (next > x || next < y)) {
        cur = moveRight(x, y, deltas);
        relax(cur);
      }
      if (y < x && (prev > y && prev < x)) {
        cur = moveLeft(x, y, deltas);
        relax(cur);
      }
      if (y > x && (prev < x || prev > y)) {
        cur = moveLeft(x, y, deltas);
        relax(cur);
      }
      if (y > x && (next > x && next < y)) {
        cur = moveRight(x, y, deltas);
        relax(cur);
      }
    }
    return dst;
  };
  vec<int> dp(n, INF);
  vec<tuple<int, int, int>> parentFrom(n);
  for (int i = 0; i < (positions[0].size()); ++i) {
    dp[positions[0][i]] = calcTravel(s, 0, i);
    parentFrom[positions[0][i]] = {s, 0, i};
  }
  for (int i = 0; i < (maxValue - 1); ++i) {
    for (auto pos : positions[i]) {
      for (int j = 0; j < (positions[i + 1].size()); ++j) {
        deltaMoves.clear();
        auto dst = calcTravel(pos, i + 1, j);
        if (dp[positions[i + 1][j]] > dp[pos] + dst) {
          dp[positions[i + 1][j]] = dp[pos] + dst;
          parentFrom[positions[i + 1][j]] = {pos, i + 1, j};
        }
      }
    }
  }
  int finalPos = -1;
  for (auto pos : positions.back()) {
    if (finalPos == -1 || dp[finalPos] > dp[pos]) {
      finalPos = pos;
    }
  }
  out(dp[finalPos]);
  int cur = finalPos;
  vec2d<int> allMoves;
  while (true) {
    auto prevTuple = parentFrom[cur];
    int prevPos = get<0>(prevTuple);
    int row = get<1>(prevTuple);
    int j = get<2>(prevTuple);
    ;
    ;
    deltaMoves.clear();
    calcTravel(prevPos, row, j);
    allMoves.push_back(deltaMoves);
    cur = prevPos;
    if (prevPos == s && row == 0) {
      break;
    }
  }
  reverse(allMoves.begin(), allMoves.end());
  ;
  ;
  cur = s;
  int lookingFor = 0;
  vec<int> used(n, false);
  int sum = 0;
  for (const auto& moves : allMoves) {
    for (auto x : moves) {
      if (x == 0) {
        out << "+0\n";
        continue;
      }
      int absX = abs(x);
      int dx = 0;
      if (x > 0) {
        dx = 1;
      } else if (x < 0) {
        dx = -1;
      }
      char c = '+';
      if (dx < 0) c = '-';
      for (int i = 0; i < (absX); ++i) {
        cur += dx;
        cur += n;
        cur %= n;
        ++sum;
        if (!used[cur]) {
          if (a[cur] == lookingFor) {
            used[cur] = true;
            out << c << sum << "\n";
            sum = 0;
          }
        }
      }
    }
    ++lookingFor;
  }
}
int main() {
  solve(cin, cout);
  return 0;
}