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;
int n, s, ds;
int a[2010], lst[2010][2010], nxt[2010][2010], dp[2010][2010][2];
void read() {
  cin >> n >> s;
  --s;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
}
void normalize() {
  vector<pair<int, int> > v;
  for (int i = 0; i < n; ++i) {
    v.push_back(make_pair(a[i], i));
  }
  sort(v.begin(), v.end());
  ds = 0;
  for (int i = 0; i < v.size(); ++i) {
    if (i != 0 && v[i].first != v[i - 1].first) ++ds;
    a[v[i].second] = ds;
  }
}
void precalc() {
  for (int i = 0; i <= ds; ++i) {
    int last = -1;
    for (int j = 0, times = 0; times < 2 * n;
         j = j < n - 1 ? j + 1 : 0, ++times) {
      lst[i][j] = last;
      if (a[j] == i) last = j;
    }
    last = -1;
    for (int j = n - 1, times = 0;
         times<2 * n; j = j> 0 ? j - 1 : n - 1, ++times) {
      nxt[i][j] = last;
      if (a[j] == i) last = j;
    }
  }
}
int dist(int i, int j) { return (j - i + n) % n; }
struct source {
  int i, j, k;
  source() : i(-1), j(-1), k(-1) {}
  source(int i, int j, int k) : i(i), j(j), k(k) {}
} from[2010][2010][2];
void update(int i2, int j2, int k2, int i1, int j1, int k1, int val) {
  if (dp[i1][j1][k1] + val < dp[i2][j2][k2]) {
    dp[i2][j2][k2] = dp[i1][j1][k1] + val;
    from[i2][j2][k2] = source(i1, j1, k1);
  }
}
void printDist(int a, int b) {
  if (dist(a, b) < dist(b, a)) {
    cout << '+' << dist(a, b);
  } else {
    cout << '-' << dist(b, a);
  }
  cout << "\n";
}
void rec(int i, int j, int k) {
  if (i == -1) {
    return;
  }
  int fi = from[i][j][k].i, fj = from[i][j][k].j, fk = from[i][j][k].k;
  rec(fi, fj, fk);
  int cr = (k == 0 ? i : j);
  int fcr;
  if (fi == -1)
    fcr = s;
  else
    fcr = (fk == 0 ? fi : fj);
  printDist(fcr, cr);
}
void solve() {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < 2; ++k) {
        dp[i][j][k] = 1000000000;
      }
    }
  }
  int ans = 1000000000;
  source ansSource;
  if (a[s] == 0) {
    dp[s][s][0] = 0;
  } else {
    dp[nxt[0][s]][nxt[0][s]][0] = dist(s, nxt[0][s]);
    dp[lst[0][s]][lst[0][s]][0] =
        min(dp[lst[0][s]][lst[0][s]][0], dist(lst[0][s], s));
  }
  for (int i = 0; i <= ds; ++i) {
    vector<int> good;
    for (int j = 0; j < n; ++j) {
      if (a[j] == i) good.push_back(j);
    }
    for (int len = 1; len <= n; ++len) {
      for (int j = 0; j < good.size(); ++j) {
        for (int k = 0; k < 2; ++k) {
          int now = good[j];
          int then = (now + len - 1) % n;
          int current = (k == 0 ? now : then);
          if (dp[now][then][k] == 1000000000) continue;
          int nxt1 = lst[i][now];
          int nxt2 = nxt[i][then];
          if (nxt1 == then) {
            if (i == ds) {
              if (ans > dp[now][then][k]) {
                ans = dp[now][then][k];
                ansSource = source(now, then, k);
              }
            } else {
              nxt1 = lst[i + 1][now];
              nxt2 = nxt[i + 1][now];
              update(nxt1, nxt1, 0, now, then, k, dist(nxt1, current));
              update(nxt2, nxt2, 0, now, then, k, dist(current, nxt2));
            }
          } else {
            update(nxt1, then, 0, now, then, k, dist(nxt1, current));
            update(now, nxt2, 1, now, then, k, dist(current, nxt2));
          }
        }
      }
    }
  }
  cout << ans << "\n";
  rec(ansSource.i, ansSource.j, ansSource.k);
}
int main() {
  read();
  normalize();
  precalc();
  solve();
}