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;
int a[2020], b[2020], lshcnt;
int f[2020][2020], g[2020][2020];
pair<int, int> preg[2020][2020];
int pref[2020][2020];
int l[2020], r[2020], rev[2020], tag[2020];
vector<int> pos[2020];
inline int dis(int x, int y) {
  if (x <= y) return y - x;
  return n - x + y;
}
inline int mdis(int x, int y) { return min(dis(x, y), dis(y, x)); }
inline int mo(int x) {
  if (x > n) return x - n;
  return x;
}
void dfsg(int, int);
void dfsf(int p, int v) {
  int u = pref[p][v];
  dfsg(p - 1, u);
  if (dis(u, v) <= dis(v, u))
    printf("+%d\n", dis(u, v));
  else
    printf("-%d\n", dis(v, u));
}
void dfsg(int p, int v) {
  if (p == 0) return;
  int u = preg[p][v].first, way = preg[p][v].second;
  dfsf(p, u);
  if (pos[p].size() == 1) return;
  tag[u] = 1;
  int cur = u, out = 0;
  if (way == 0) {
    while (cur != l[v]) {
      out += dis(cur, r[cur]);
      cur = r[cur];
      if (!tag[cur]) {
        if (out >= 0)
          printf("+%d\n", out);
        else
          printf("-%d\n", -out);
        out = 0;
      }
      tag[cur] = 1;
    }
    while (cur != v) {
      out -= dis(l[cur], cur);
      cur = l[cur];
      if (!tag[cur]) {
        if (out >= 0)
          printf("+%d\n", out);
        else
          printf("-%d\n", -out);
        out = 0;
      }
      tag[cur] = 1;
    }
  } else {
    while (cur != r[v]) {
      out -= dis(l[cur], cur);
      cur = l[cur];
      if (!tag[cur]) {
        if (out >= 0)
          printf("+%d\n", out);
        else
          printf("-%d\n", out);
        out = 0;
      }
      tag[cur] = 1;
    }
    while (cur != v) {
      out += dis(cur, r[cur]);
      cur = r[cur];
      if (!tag[cur]) {
        if (out >= 0)
          printf("+%d\n", out);
        else
          printf("-%d\n", out);
        out = 0;
      }
      tag[cur] = 1;
    }
  }
}
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), b[i] = a[i];
  sort(b + 1, b + 1 + n);
  lshcnt = unique(b + 1, b + 1 + n) - b - 1;
  for (int i = 1; i <= n; ++i) {
    a[i] = lower_bound(b + 1, b + 1 + lshcnt, a[i]) - b;
    pos[a[i]].emplace_back(i);
    rev[i] = pos[a[i]].size() - 1;
  }
  for (int i = 1; i <= lshcnt; ++i) {
    l[pos[i].front()] = pos[i].back();
    r[pos[i].back()] = pos[i].front();
    for (int j = 0; j < pos[i].size(); ++j) {
      if (j) l[pos[i][j]] = pos[i][j - 1];
      if (j != pos[i].size() - 1) r[pos[i][j]] = pos[i][j + 1];
    }
  }
  memset(f, 0x3f, sizeof f);
  memset(g, 0x3f, sizeof g);
  g[0][s] = 0;
  pos[0].emplace_back(s);
  for (int i = 1; i <= lshcnt; ++i) {
    for (int p : pos[i])
      for (int q : pos[i - 1]) {
        int d = g[i - 1][q] + mdis(p, q);
        if (d < f[i][p]) {
          f[i][p] = d;
          pref[i][p] = q;
        }
      }
    if (pos[i].size() == 1) {
      g[i][pos[i][0]] = f[i][pos[i][0]];
      preg[i][pos[i][0]] = make_pair(pos[i][0], 2);
      continue;
    }
    for (int p : pos[i]) {
      for (int q : pos[i]) {
        if (p == q) continue;
        int d = f[i][p] + dis(p, l[q]) * 2 + dis(q, p);
        if (d < g[i][q]) {
          g[i][q] = d;
          preg[i][q] = make_pair(p, 0);
        }
        d = f[i][p] + dis(r[q], p) * 2 + dis(p, q);
        if (d < g[i][q]) {
          g[i][q] = d;
          preg[i][q] = make_pair(p, 1);
        }
      }
    }
  }
  int ans = 0x3f3f3f3f, u;
  for (int p : pos[lshcnt]) {
    if (g[lshcnt][p] < ans) {
      ans = g[lshcnt][p];
      u = p;
    }
  }
  printf("%d\n", ans);
  dfsg(lshcnt, u);
}