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>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
int S, a[2105], cnt;
unordered_map<int, int> id;
vector<int> lv[2105];
int dis(int i, int j) {
  if (i <= j) return j - i;
  return j + n - i;
}
int in[2105], out[2105], inPre[2105], outPre[2105];
void pp(int st, int ed) {
  if (dis(st, ed) <= dis(ed, st)) {
    printf("+%d\n", dis(st, ed));
  } else
    printf("-%d\n", dis(ed, st));
}
void ppi(int pre, int nxt) {
  if (pre == nxt) return;
  int ce = id[a[pre]];
  int N = lv[ce].size();
  for (int(i) = 0; (i) < (int)(N); (i)++)
    if (lv[ce][i] == pre) {
      assert(lv[ce][(i + 1) % N] == nxt || lv[ce][(i - 1 + N) % N] == nxt);
      int st = pre;
      if (lv[ce][(i + 1) % N] == nxt) {
        for (int j = i - 1;; j--) {
          int ed = lv[ce][(j + N) % N];
          pp(st, ed);
          if (ed == nxt) return;
          st = ed;
        }
      } else {
        for (int j = i + 1;; j++) {
          int ed = lv[ce][(j) % N];
          pp(st, ed);
          if (ed == nxt) return;
          st = ed;
        }
      }
      return;
    }
}
void doLevel(int L) {
  if (lv[L].size() == 1) {
    out[lv[L][0]] = in[lv[L][0]];
    outPre[lv[L][0]] = lv[L][0];
    return;
  }
  int N = lv[L].size();
  for (int(i) = 0; (i) < (int)(N); (i)++) {
    int pos = lv[L][i];
    for (int j = i - 1; j <= i + 1; j += 2) {
      int pos1 = lv[L][(j + N) % N];
      int G = in[pos] + n - (j < i ? dis(pos1, pos) : dis(pos, pos1));
      if (G < out[pos1]) {
        out[pos1] = G;
        outPre[pos1] = pos;
      }
    }
  }
}
void work() {
  for (int(i) = 0; (i) < (int)(2105); (i)++) {
    in[i] = out[i] = (1 << 30);
  }
  for (int pos : lv[1]) {
    in[pos] = min(dis(S, pos), dis(pos, S));
  }
  doLevel(1);
  for (int L = 2; L <= cnt; L++) {
    for (int pos : lv[L - 1]) {
      for (int pos1 : lv[L]) {
        int G = out[pos] + min(dis(pos1, pos), dis(pos, pos1));
        if (G < in[pos1]) {
          in[pos1] = G;
          inPre[pos1] = pos;
        }
      }
    }
    doLevel(L);
  }
  int ans = (1 << 30), tar = -1;
  vector<int> V;
  for (int pos : lv[cnt]) {
    if (out[pos] < ans) {
      ans = out[pos];
      tar = pos;
    }
  }
  for (int L = cnt; L; L--) {
    V.push_back(tar);
    V.push_back({outPre[tar]});
    tar = inPre[outPre[tar]];
  }
  printf("%d\n", ans);
  pp(S, V.back());
  for (int i = V.size() - 1; i > 0; i--) {
    int pre = V[i], nxt = V[i - 1];
    if (a[pre] != a[nxt]) {
      pp(pre, nxt);
    } else {
      ppi(pre, nxt);
    }
  }
}
void fmain() {
  scanf("%d%d", &n, &S);
  set<int> ts;
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    scanf("%d", a + i);
    ts.insert(a[i]);
  }
  for (int z : ts) id[z] = ++cnt;
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    lv[id[a[i]]].push_back(i);
  }
  work();
}
int main() {
  fmain();
  return 0;
}