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 N = 2500;
struct node {
  int a, id;
  bool operator<(node T) const {
    if (a == T.a) return id < T.id;
    return a < T.a;
  }
} a[N];
int n, start[N], k = 0, pos;
int val[N];
int finish[N];
int last[N];
pair<int, int> inner[N];
vector<int> block[N];
inline int GetDist(int i, int j) { return min(abs(i - j), n - abs(i - j)); }
inline int getLeft(int i, int j) {
  if (i >= j) return i - j;
  return i + n - j;
}
inline int getRight(int i, int j) {
  if (i <= j) return j - i;
  return n + j - i;
}
inline void recalc(int id) {
  if ((int)block[id].size() == 1) {
    finish[block[id][0]] = start[block[id][0]];
    inner[block[id][0]] = make_pair(block[id][0], 0);
    return;
  }
  for (int i = 0; i < (int)block[id].size(); ++i) {
    int nxt = i + 1;
    int prv = i - 1;
    if (nxt >= (int)block[id].size()) nxt = 0;
    if (prv < 0) prv = (int)block[id].size() - 1;
    nxt = block[id][nxt];
    prv = block[id][prv];
    for (int j = 0; j < (int)block[id].size(); ++j) {
      if (finish[block[id][j]] > start[block[id][i]] +
                                     getRight(block[id][i], prv) +
                                     GetDist(prv, block[id][j])) {
        finish[block[id][j]] = start[block[id][i]] +
                               getRight(block[id][i], prv) +
                               GetDist(prv, block[id][j]);
        inner[block[id][j]] = make_pair(block[id][i], 0);
      }
      if (finish[block[id][j]] > start[block[id][i]] +
                                     getLeft(block[id][i], nxt) +
                                     GetDist(nxt, block[id][j])) {
        finish[block[id][j]] = start[block[id][i]] +
                               getLeft(block[id][i], nxt) +
                               GetDist(nxt, block[id][j]);
        inner[block[id][j]] = make_pair(block[id][i], 1);
      }
    }
  }
}
inline void Find(int id) {
  for (int i = 0; i < (int)block[id].size(); ++i) {
    for (int j = 0; j < (int)block[id + 1].size(); ++j) {
      if (start[block[id + 1][j]] >
          finish[block[id][i]] + GetDist(block[id][i], block[id + 1][j])) {
        start[block[id + 1][j]] =
            finish[block[id][i]] + GetDist(block[id][i], block[id + 1][j]);
        last[block[id + 1][j]] = block[id][i];
      }
    }
  }
}
int main() {
  scanf("%d%d", &n, &pos);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i].a);
    a[i].id = i;
    val[i] = a[i].a;
  }
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n;) {
    int j = i;
    while (j + 1 <= n && a[i].a == a[j + 1].a) ++j;
    ++k;
    for (; i <= j; ++i) {
      block[k].push_back(a[i].id);
    }
  }
  for (int i = 1; i <= n; ++i) {
    start[i] = 1000000000;
    finish[i] = 1000000000;
  }
  for (int i = 0; i < (int)block[1].size(); ++i) {
    start[block[1][i]] = GetDist(pos, block[1][i]);
    last[block[1][i]] = pos;
  }
  for (int i = 1; i <= k; ++i) {
    recalc(i);
    if (i < k) {
      Find(i);
    }
  }
  int ans = 1000000000, v = 0;
  for (int i = 0; i < (int)block[k].size(); ++i) {
    if (ans > finish[block[k][i]]) {
      ans = finish[block[k][i]];
      v = block[k][i];
    }
  }
  printf("%d\n", ans);
  vector<int> all;
  for (int now = k; now > 0; --now) {
    int nxt = inner[v].first;
    int dir = inner[v].second;
    int who = val[v];
    for (int cnt = 0;;) {
      if (v == nxt && cnt >= (int)block[now].size()) break;
      if (who == val[v]) {
        all.push_back(v);
        cnt++;
        val[v] = 1000000000;
      }
      if (!dir)
        --v;
      else
        ++v;
      if (v <= 0) v = n;
      if (v > n) v = 1;
    }
    v = last[v];
  }
  for (int i = (int)all.size() - 1; i >= 0; --i) {
    if (getRight(pos, all[i]) <= getLeft(pos, all[i]))
      printf("+");
    else
      printf("-");
    printf("%d\n", GetDist(pos, all[i]));
    pos = all[i];
  }
  return 0;
}