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;
const int maxn = 2005;
const int INF = 0x3f3f3f3f;
int n, s;
int a[maxn << 1], vis[maxn], nxt[maxn << 1][maxn], prv[maxn << 1][maxn],
    lst[maxn];
int f[maxn][maxn], h[maxn][maxn];
vector<int> g[maxn][maxn];
vector<int> vec;
vector<int> pos[maxn];
inline void disC(int p1, int p2, int &nf, vector<int> &ng) {
  if (p1 > p2) p2 += n;
  nf += p2 - p1;
  ng.push_back(p2 - p1);
  return;
}
inline void disR(int p1, int p2, int &nf, vector<int> &ng) {
  if (p1 < p2) p1 += n;
  nf += p1 - p2;
  ng.push_back(p2 - p1);
  return;
}
inline bool between(int x, int y, int z) {
  x %= n;
  y %= n;
  z %= n;
  if (z <= x) z += n;
  if (y < x) y += n;
  return y > x && y < z;
}
inline void calcCGB(int p1, int p2, int &nf, vector<int> &ng) {
  int resf = 0;
  vector<int> resg;
  resg.clear();
  int to = prv[p1 + n][a[p2]] % n;
  if (between(p2, to, p1)) {
    disC(p1, p2, resf, resg);
    disC(p2, to, resf, resg);
    disR(to, p2, resf, resg);
  } else
    disC(p1, p2, resf, resg);
  if (resf < nf) nf = resf, ng = resg;
  return;
}
inline void calcCBG(int p1, int p2, int &nf, vector<int> &ng) {
  int resf = 0;
  vector<int> resg;
  resg.clear();
  int to = nxt[p2][a[p2]] % n;
  if (between(p2, to, p1)) {
    disR(p1, to, resf, resg);
    disC(to, p2, resf, resg);
  } else
    disC(p1, p2, resf, resg);
  if (resf < nf) nf = resf, ng = resg;
  return;
}
inline void calcRGB(int p1, int p2, int &nf, vector<int> &ng) {
  int resf = 0;
  vector<int> resg;
  resg.clear();
  int to = nxt[p1][a[p2]] % n;
  if (between(p1, to, p2)) {
    disR(p1, to, resf, resg);
    disC(to, p2, resf, resg);
  } else
    disR(p1, p2, resf, resg);
  if (resf < nf) nf = resf, ng = resg;
  return;
}
inline void calcRBG(int p1, int p2, int &nf, vector<int> &ng) {
  int resf = 0;
  vector<int> resg;
  resg.clear();
  int to = prv[p2 + n][a[p2]] % n;
  if (between(p1, to, p2)) {
    disC(p1, to, resf, resg);
    disR(to, p2, resf, resg);
  } else
    disR(p1, p2, resf, resg);
  if (resf < nf) nf = resf, ng = resg;
}
inline void calc(int p1, int p2, int &nf, vector<int> &ng) {
  nf = INF;
  calcCGB(p1, p2, nf, ng);
  calcCBG(p1, p2, nf, ng);
  calcRGB(p1, p2, nf, ng);
  calcRBG(p1, p2, nf, ng);
  return;
}
inline void print(int x) {
  printf("%c%d\n", x < 0 ? '-' : '+', abs(x));
  return;
}
int x, dlt;
inline void go(int i, int j) {
  if (i > 0) go(i - 1, h[i][j]);
  for (int k = (0); k < (g[i][j].size()); ++k) {
    int d = (g[i][j][k] < 0 ? -1 : 1), len = abs(g[i][j][k]);
    for (int l = (0); l <= (len); ++l) {
      if (a[x] == i && !vis[x]) print(dlt), dlt = 0, vis[x] = true;
      ((x += d) += n) %= n;
      dlt += d;
    }
    ((x -= d) += n) %= n;
    (dlt -= d);
  }
  return;
}
int main() {
  scanf("%d%d", &n, &s);
  --s;
  for (int i = (0); i < (n); ++i) {
    scanf("%d", a + i);
    vec.push_back(a[i]);
  }
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  int mx = 0;
  for (int i = (0); i < (n); ++i) {
    a[i] = lower_bound(vec.begin(), vec.end(), a[i]) - vec.begin(),
    mx = max(mx, a[i]);
    pos[a[i]].push_back(i);
  }
  for (int i = (0); i < (n); ++i) a[n + i] = a[i];
  memset(lst, -1, sizeof(lst));
  for (int i = (n << 1) - 1; i >= 0; --i) {
    for (int j = (0); j <= (mx); ++j) nxt[i][j] = lst[j];
    lst[a[i]] = i;
  }
  memset(lst, -1, sizeof(lst));
  for (int i = (0); i < (n << 1); ++i) {
    for (int j = (0); j <= (mx); ++j) prv[i][j] = lst[j];
    lst[a[i]] = i;
  }
  memset(f, 0x3f, sizeof(f));
  for (int i = (0); i < (pos[0].size()); ++i)
    calc(s, pos[0][i], f[0][i], g[0][i]);
  for (int i = (1); i <= (mx); ++i)
    for (int j = (0); j < (pos[i].size()); ++j)
      for (int k = (0); k < (pos[i - 1].size()); ++k)
        if (f[i - 1][k] != INF) {
          int nf = 0;
          vector<int> ng;
          calc(pos[i - 1][k], pos[i][j], nf, ng);
          nf += f[i - 1][k];
          if (nf < f[i][j]) f[i][j] = nf, g[i][j] = ng, h[i][j] = k;
        }
  int best = -1;
  for (int i = (0); i < (pos[mx].size()); ++i)
    if (!~best || f[mx][i] < f[mx][best]) best = i;
  printf("%d\n", f[mx][best]);
  x = s, dlt = 0;
  go(mx, best);
  return 0;
}