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;
template <typename T>
void cmax(T& x, T y) {
  if (x < y) x = y;
}
template <typename T>
void cmin(T& x, T y) {
  if (x > y) x = y;
}
inline int read() {
  int f = 1, x = 0;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}
const int N = 2005, INF = 2e9;
int n, m, s, a[N], b[N], dp[N][N];
vector<int> v[N], al;
inline int dis(int x, int y) { return (y - x) < 0 ? (y - x + n) : (y - x); }
inline int get_p(int i, int x) {
  return (x == 0) ? ((int)v[i].size()) - 1 : x - 1;
}
inline int get_s(int i, int x) {
  return (x + 1 == ((int)v[i].size())) ? 0 : x + 1;
}
struct T {
  int a, b, c, d;
} f[N][N];
inline void print(int c, int x) {
  if (c == 0) return;
  T r = f[c][x];
  if (r.c != x) {
    if (r.d == 1) {
      if (r.c < x)
        for (int i = (x - 1); i >= (r.c); i--)
          al.push_back(v[c][i + 1] - v[c][i]);
      else {
        for (int i = (x - 1); i >= (0); i--)
          al.push_back(v[c][i + 1] - v[c][i]);
        al.push_back(v[c][0] - v[c][((int)v[c].size()) - 1] + n);
        for (int i = (((int)v[c].size()) - 2); i >= (r.c); i--)
          al.push_back(v[c][i + 1] - v[c][i]);
      }
    } else {
      if (r.c > x)
        for (int i = (x); i <= (r.c - 1); i++)
          al.push_back(v[c][i] - v[c][i + 1]);
      else {
        for (int i = (x); i <= (((int)v[c].size()) - 2); i++)
          al.push_back(v[c][i] - v[c][i + 1]);
        al.push_back(v[c][((int)v[c].size()) - 1] - v[c][0] - n);
        for (int i = (0); i <= (r.c - 1); i++)
          al.push_back(v[c][i] - v[c][i + 1]);
      }
    }
  }
  if (r.b == 0)
    al.push_back(-dis(v[c][r.c], v[c - 1][r.a]));
  else
    al.push_back(dis(v[c - 1][r.a], v[c][r.c]));
  print(c - 1, r.a);
}
int main() {
  n = read(), s = read();
  for (int i = (1); i <= (n); i++) b[i] = a[i] = read();
  sort(b + 1, b + n + 1);
  m = unique(b + 1, b + n + 1) - b - 1;
  for (int i = (1); i <= (n); i++)
    a[i] = lower_bound(b + 1, b + m + 1, a[i]) - b, v[a[i]].push_back(i);
  for (int i = (0); i <= (n); i++)
    for (int j = (0); j <= (n); j++) dp[i][j] = INF;
  dp[0][0] = 0, v[0].push_back(s);
  if (((int)v[1].size()) == 1 && s == v[1][0])
    dp[1][0] = 0, f[1][0] = T{0, 0, 0, 0};
  for (int i = (0); i <= (m - 1); i++)
    for (int x = (0); x <= (((int)v[i].size()) - 1); x++)
      for (int y = (0); y <= (((int)v[i + 1].size()) - 1); y++) {
        int c = i + 1;
        int p1 = get_p(c, y), s1 = get_s(c, y);
        if (v[i][x] == v[c][y]) continue;
        if ((v[i][x] <= v[c][y] &&
             (v[c][p1] >= v[c][y] || v[c][p1] <= v[i][x])) ||
            (v[i][x] >= v[c][y] && v[c][p1] >= v[c][y] &&
             v[c][p1] <= v[i][x])) {
          if (dp[c][y] > dp[i][x] + dis(v[c][y], v[i][x])) {
            dp[c][y] = dp[i][x] + dis(v[c][y], v[i][x]);
            f[c][y] = T{x, 0, p1, 0};
          }
        } else if (dp[c][y] >
                   dp[i][x] + dis(v[i][x], v[c][p1]) + dis(v[c][y], v[c][p1])) {
          dp[c][y] = dp[i][x] + dis(v[i][x], v[c][p1]) + dis(v[c][y], v[c][p1]);
          f[c][y] = T{x, 1, p1, 0};
        }
        if ((v[i][x] <= v[c][y] && v[i][x] <= v[c][s1] &&
             v[c][y] >= v[c][s1]) ||
            (v[i][x] >= v[c][y] &&
             (v[i][x] <= v[c][s1] || v[c][y] >= v[c][s1]))) {
          if (dp[c][y] > dp[i][x] + dis(v[i][x], v[c][y])) {
            dp[c][y] = dp[i][x] + dis(v[i][x], v[c][y]);
            f[c][y] = T{x, 1, s1, 1};
          }
        } else if (dp[c][y] >
                   dp[i][x] + dis(v[c][s1], v[i][x]) + dis(v[c][s1], v[c][y])) {
          dp[c][y] = dp[i][x] + dis(v[c][s1], v[i][x]) + dis(v[c][s1], v[c][y]);
          f[c][y] = T{x, 0, s1, 1};
        }
      }
  int ans = INF, mk;
  for (int i = (0); i <= (((int)v[m].size()) - 1); i++)
    if (ans > dp[m][i]) ans = min(ans, dp[m][i]), mk = i;
  printf("%d\n", ans);
  print(m, mk);
  for (int i = (((int)al.size()) - 1); i >= (0); i--) {
    if (al[i] >= 0) putchar('+');
    printf("%d\n", al[i]);
  }
  return 0;
}