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 = 2000 + 5;
const int INF = 1 << 30;
int dp[MAXN][2], a[MAXN], b[MAXN], num[MAXN][MAXN];
int n, s, m;
int clockwise(int l, int r) { return (r - l + n) % n; }
void print(int u, int k) {
  if (!num[a[u] + 1][0] && k == 1) return;
  if (!k) {
    int m = num[a[u]][0];
    if (m == 1)
      print(u, 1);
    else {
      int l = lower_bound(num[a[u]] + 1, num[a[u]] + m + 1, u) - num[a[u]];
      l = l == 1 ? num[a[u]][m] : num[a[u]][l - 1];
      if (dp[u][k] == dp[l][1] + clockwise(u, l)) {
        l = lower_bound(num[a[u]] + 1, num[a[u]] + m + 1, u) - num[a[u]];
        l = l == m ? 1 : l + 1;
        int last = u;
        for (int i = l; num[a[u]][i] != u; i = i == m ? 1 : i + 1) {
          printf("+%d\n", clockwise(last, num[a[u]][i]));
          last = num[a[u]][i];
        }
        print(last, 1);
      } else {
        l = lower_bound(num[a[u]] + 1, num[a[u]] + m + 1, u) - num[a[u]];
        l = l == 1 ? m : l - 1;
        int last = u;
        for (int i = l; num[a[u]][i] != u; i = i == 1 ? m : i - 1) {
          printf("-%d\n", clockwise(num[a[u]][i], last));
          last = num[a[u]][i];
        }
        print(last, 1);
      }
    }
  } else {
    for (int i = 1; i <= num[a[u] + 1][0]; ++i) {
      int j = num[a[u] + 1][i], cw = clockwise(u, j), cc = clockwise(j, u);
      if (dp[u][k] == dp[j][0] + cw) {
        printf("+%d\n", cw);
        print(j, 0);
        break;
      } else if (dp[u][k] == dp[j][0] + cc) {
        printf("-%d\n", cc);
        print(j, 0);
        break;
      }
    }
  }
}
int dfs(int u, int k) {
  if (~dp[u][k]) return dp[u][k];
  int &ret = dp[u][k];
  ret = INF;
  if (!k) {
    int m = num[a[u]][0];
    if (m == 1)
      ret = dfs(u, 1);
    else {
      int l = lower_bound(num[a[u]] + 1, num[a[u]] + m + 1, u) - num[a[u]];
      int r = upper_bound(num[a[u]] + 1, num[a[u]] + m + 1, u) - num[a[u]];
      l = l == 1 ? num[a[u]][m] : num[a[u]][l - 1];
      r = r == m + 1 ? num[a[u]][1] : num[a[u]][r];
      ret = min(ret,
                min(clockwise(u, l) + dfs(l, 1), clockwise(r, u) + dfs(r, 1)));
    }
  } else {
    for (int i = 1; i <= num[a[u] + 1][0]; ++i) {
      int j = num[a[u] + 1][i];
      ret = min(ret, dfs(j, 0) + min(clockwise(u, j), clockwise(j, u)));
    }
  }
  return ret;
}
int main() {
  while (~scanf("%d%d", &n, &s)) {
    --s;
    memset(dp, -1, sizeof(dp));
    for (int i = 0; i < n; ++i) {
      scanf("%d", a + i);
      b[i] = a[i];
      num[i][0] = 0;
    }
    num[n][0] = 0;
    sort(b, b + n);
    int m = unique(b, b + n) - b;
    for (int i = 0; i < n; ++i) {
      int k = lower_bound(b, b + m, a[i]) - b;
      a[i] = k;
      num[k][++num[k][0]] = i;
      if (k == m - 1) dp[i][1] = 0;
    }
    int ans = INF;
    for (int i = 0; i < n; ++i) {
      if (!a[i]) {
        ans =
            min(ans,
                (dfs(i, 0) + min(clockwise(i, s), clockwise(s, i))) * MAXN + i);
      }
    }
    printf("%d\n", ans / MAXN);
    int pos = ans % MAXN;
    if (ans == (dp[pos][0] + clockwise(s, pos)) * MAXN + pos)
      printf("+%d\n", clockwise(s, pos));
    else
      printf("-%d\n", clockwise(pos, s));
    print(pos, 0);
  }
  return 0;
}