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, a[2010], f[2010], g[2010], p[2010], pre[2010], tot;
bool cw[2010];
pair<int, int> sec[2010];
bool cmp(int x, int y) { return (a[x] > a[y]) || (a[x] == a[y] && x < y); }
int dis(int x, int y) { return min(abs(x - y), n - abs(x - y)); }
int cwdis(int x, int y) { return (y - x + n) % n; }
int ccwdis(int x, int y) { return (x - y + n) % n; }
void moveto(int x, int y) {
  int d1 = cwdis(x, y), d2 = ccwdis(x, y);
  if (d1 <= d2)
    printf("+%d\n", d1);
  else
    printf("-%d\n", d2);
}
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    p[i] = i;
  }
  sort(p + 1, p + n + 1, cmp);
  int l = 1, r = 0;
  for (; l <= n; l = r + 1, r = l) {
    while (a[p[r + 1]] == a[p[l]] && r < n) r++;
    for (int i = l; i <= r; i++) {
      if (l == 1)
        g[p[i]] = 0;
      else {
        g[p[i]] = 1 << 30;
        for (int j = sec[tot].first; j <= sec[tot].second; j++)
          if (f[p[j]] + dis(p[i], p[j]) < g[p[i]])
            g[p[i]] = f[p[j]] + dis(p[i], p[j]), pre[i] = j;
      }
    }
    if (l == r)
      f[p[l]] = g[p[l]];
    else
      for (int i = l; i <= r; i++) {
        int u = i == l ? p[r] : p[i - 1];
        int v = i == r ? p[l] : p[i + 1];
        if (g[u] + cwdis(p[i], u) < g[v] + cwdis(v, p[i]))
          f[p[i]] = g[u] + cwdis(p[i], u), cw[i] = 1;
        else
          f[p[i]] = g[v] + cwdis(v, p[i]), cw[i] = 0;
      }
    sec[++tot] = make_pair(l, r);
  }
  int ans = 1 << 30, k;
  for (int i = sec[tot].first; i <= sec[tot].second; i++)
    if (f[p[i]] + dis(s, p[i]) < ans) ans = f[p[i]] + dis(s, p[i]), k = i;
  printf("%d\n", ans);
  moveto(s, p[k]);
  for (int i = tot; i; i--) {
    int len = sec[i].second - sec[i].first + 1, l = sec[i].first;
    if (cw[k]) {
      for (int j = 1; j < len; j++)
        printf("+%d\n",
               cwdis(p[(k + j - 1 - l) % len + l], p[(k + j - l) % len + l]));
      k = (k - 1 + len - l) % len + l;
    } else {
      for (int j = 1; j < len; j++)
        printf("-%d\n", ccwdis(p[(k - j + 1 + len - l) % len + l],
                               p[(k - j + len - l) % len + l]));
      k = (k + 1 + len - l) % len + l;
    }
    if (i > 1) {
      moveto(p[k], p[pre[k]]);
      k = pre[k];
    }
  }
}