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;
void read(long long &x) { scanf("%lld", &x); }
void read(long long &x, long long &y) { scanf("%lld%lld", &x, &y); }
void read(long long &x, long long &y, long long &z) {
  scanf("%lld%lld%lld", &x, &y, &z);
}
void print(long long x) { printf("%lld ", x); }
void println(long long x) { printf("%lld\n", x); }
const long long N = 2010;
long long n, s, a[N], b[N], sz, d[2][N][N], p[2][N][N], ans = 1e9, to, len,
                                                        len2, pos, res[N];
map<long long, long long> ma;
vector<long long> v[N];
long long dist(long long a, long long b) {
  if (a > b) swap(a, b);
  return min(b - a, n - b + a);
}
long long distl(long long a, long long b) {
  if (b <= a) return a - b;
  return n - b + a;
}
int main() {
  cin >> n >> s;
  for (long long i = 1; i <= n; i++) read(a[i]), b[i] = a[i];
  sort(b + 1, b + n + 1);
  for (long long i = 1; i <= n; i++)
    if (!ma.count(b[i])) ma[b[i]] = ++sz;
  for (long long i = 1; i <= n; i++) a[i] = ma[a[i]], v[a[i]].push_back(i);
  for (long long i = 0; i <= n; i++)
    for (long long j = 1; j <= n; j++) d[0][i][j] = d[1][i][j] = 1e9;
  d[1][0][s] = 0;
  v[0].push_back(s);
  for (long long i = 1; i <= sz; i++) {
    len = v[i].size();
    for (long long j : v[i])
      for (long long k : v[i - 1]) {
        if (d[0][i][j] > d[1][i - 1][k] + dist(j, k)) {
          d[0][i][j] = d[1][i - 1][k] + dist(j, k);
          if (distl(j, k) < distl(k, j))
            p[0][i][j] = -k;
          else
            p[0][i][j] = k;
        }
      }
    if (len == 1) {
      d[1][i][v[i][0]] = d[0][i][v[i][0]];
      p[1][i][v[i][0]] = p[0][i][v[i][0]];
    }
    for (long long j = 0; j < v[i].size(); j++)
      for (long long k : v[i])
        if (v[i][j] != k) {
          to = v[i][j];
          if (d[1][i][to] >
              d[0][i][k] + 2 * distl(k, v[i][(j + 1) % len]) + distl(to, k))
            d[1][i][to] =
                d[0][i][k] + 2 * distl(k, v[i][(j + 1) % len]) + distl(to, k),
            p[1][i][to] = -k;
          if (d[1][i][to] > d[0][i][k] +
                                2 * distl(v[i][(j + len - 1) % len], k) +
                                distl(k, to))
            d[1][i][to] = d[0][i][k] + 2 * distl(v[i][(j + len - 1) % len], k) +
                          distl(k, to),
            p[1][i][to] = k;
        }
  }
  for (long long i : v[sz]) {
    if (ans > d[1][sz][i]) ans = d[1][sz][i], pos = i;
  }
  len = n;
  for (long long i = sz; i >= 1; i--) {
    len2 = v[i].size();
    if (len2 > 1) {
      to = p[1][i][pos];
      for (long long j = 0; j < len2; j++)
        if (v[i][j] == pos) {
          if (to < 0) {
            for (long long k = (j + len2 - 1) % len2;; k--) {
              if (k < 0) k += len2;
              if (v[i][k] == ((to) >= 0 ? (to) : -(to))) {
                res[len--] = distl(v[i][(k + 1) % len2], v[i][(j + 1) % len2]);
                if (k != (j + 1) % len2) {
                  for (long long kk = (j + 2) % len2;; kk++) {
                    if (kk >= len2) kk -= len2;
                    res[len--] = -distl(v[i][kk], v[i][(kk + len2 - 1) % len2]);
                    if (kk == k) break;
                  }
                }
                break;
              }
              res[len--] = distl(v[i][(k + 1) % len2], v[i][k]);
            }
          } else {
            for (long long k = (j + 1) % len2;; k++) {
              if (k >= len2) k -= len2;
              if (v[i][k] == ((to) >= 0 ? (to) : -(to))) {
                res[len--] = -distl(v[i][(j + len2 - 1) % len2],
                                    v[i][(k + len2 - 1) % len2]);
                if (k != (j + len2 - 1) % len2) {
                  for (long long kk = (j + len2 - 2) % len2;; kk--) {
                    if (kk < 0) kk += len2;
                    res[len--] = distl(v[i][(kk + 1) % len2], v[i][kk]);
                    if (kk == k) break;
                  }
                }
                break;
              }
              res[len--] = -distl(v[i][k], v[i][(k + len2 - 1) % len2]);
            }
          }
          break;
        }
      pos = ((to) >= 0 ? (to) : -(to));
    }
    to = p[0][i][pos];
    if (to < 0)
      res[len--] = distl(pos, -to);
    else
      res[len--] = -distl(to, pos);
    pos = ((to) >= 0 ? (to) : -(to));
  }
  cout << ans << endl;
  for (long long i = 1; i <= n; i++) {
    if (res[i] >= 0)
      printf("+%lld\n", res[i]);
    else
      println(res[i]);
  }
}