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 T1, typename T2>
void chkmin(T1 &x, T2 y) {
  if (x > y) x = y;
}
template <typename T1, typename T2>
void chkmax(T1 &x, T2 y) {
  if (x < y) x = y;
}
template <typename T>
void read(T &x) {
  x = 0;
  char c = getchar();
  T neg = 1;
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  x *= neg;
}
const int MAXN = 2000;
int n, x, a[MAXN + 5], key[MAXN + 5], hs[MAXN + 5], num = 0;
vector<int> pos[MAXN + 5];
int dp[MAXN + 5][MAXN + 5];
int p[MAXN + 5], pt = 0;
int dist(int x, int y) { return (y < x) ? (n - x + y) : (y - x); }
struct data {
  int a, b, c, d, dir;
  data() {}
  data(int _a, int _b, int _c, int _d, int _dir) {
    a = _a;
    b = _b;
    c = _c;
    d = _d;
    dir = _dir;
  }
};
data pre[MAXN + 5][MAXN + 5];
void getmin(int x, int y, int z, data q) {
  if (dp[x][y] > z) dp[x][y] = z, pre[x][y] = q;
}
void solve(int x, int y) {
  memset(p, 0, sizeof(p));
  pt = 0;
  for (__typeof(pos[x].begin()) it = pos[x].begin(); it != pos[x].end(); it++)
    p[++pt] = *it;
  int pp = 1;
  for (int i = 1; i <= pt; i++)
    if (p[i] > y) {
      pp = i;
      break;
    }
  int cur = pp, mx = dist(y, p[pp]), mxpl = y, mxpr = p[pp];
  for (int i = 1; i <= pt; i++) {
    getmin(x, p[cur], dp[x - 1][y] + n + dist(y, p[cur]) - (mx << 1),
           data(y, mxpl, mxpr, p[cur], 1));
    if (cur == pt) {
      if (dist(p[pt], p[1]) > mx)
        mx = dist(p[pt], p[1]), mxpl = p[pt], mxpr = p[1];
      cur = 1;
    } else {
      if (dist(p[cur], p[cur + 1]) > mx)
        mx = dist(p[cur], p[cur + 1]), mxpl = p[cur], mxpr = p[cur + 1];
      cur++;
    }
  }
  cur = pp - 1;
  if (cur == 0) cur = pt;
  mx = dist(p[cur], y), mxpl = y, mxpr = p[cur];
  for (int i = 1; i <= pt; i++) {
    getmin(x, p[cur], dp[x - 1][y] + n + dist(p[cur], y) - (mx << 1),
           data(y, mxpl, mxpr, p[cur], -1));
    if (cur == 1) {
      if (dist(p[pt], p[1]) > mx)
        mx = dist(p[pt], p[1]), mxpl = p[1], mxpr = p[pt];
      cur = pt;
    } else {
      if (dist(p[cur - 1], p[cur]) > mx)
        mx = dist(p[cur - 1], p[cur]), mxpl = p[cur], mxpr = p[cur - 1];
      cur--;
    }
  }
}
int now;
void findway(int x, int y) {
  if (dp[x][y] == 0) return;
  findway(x - 1, pre[x][y].a);
  memset(p, 0, sizeof(p));
  pt = 0;
  for (__typeof(pos[x].begin()) it = pos[x].begin(); it != pos[x].end(); it++)
    p[++pt] = *it;
  vector<int> vv;
  int pp = 1, cur;
  for (int i = 1; i <= pt; i++)
    if (p[i] > pre[x][y].a) {
      pp = i;
      break;
    }
  cur = pp;
  if (pre[x][y].b != pre[x][y].a) {
    if (pre[x][y].dir == 1) {
      while (p[cur] != pre[x][y].b) {
        vv.push_back(p[cur]);
        cur++;
        if (cur > pt) cur = 1;
      }
      vv.push_back(pre[x][y].b);
    } else {
      cur--;
      if (cur == 0) cur = pt;
      while (p[cur] != pre[x][y].b) {
        vv.push_back(p[cur]);
        cur--;
        if (cur <= 0) cur = pt;
      }
      vv.push_back(pre[x][y].b);
    }
  }
  cur = pp;
  if (pre[x][y].dir == 1) {
    cur--;
    if (cur <= 0) cur = pt;
  }
  if (pre[x][y].dir == 1) {
    while (p[cur] != pre[x][y].c) {
      vv.push_back(p[cur]);
      cur--;
      if (cur <= 0) cur = pt;
    }
    vv.push_back(pre[x][y].c);
  } else {
    while (p[cur] != pre[x][y].c) {
      vv.push_back(p[cur]);
      cur++;
      if (cur > pt) cur = 1;
    }
    vv.push_back(pre[x][y].c);
  }
  for (__typeof(vv.begin()) it = vv.begin(); it != vv.end(); it++) {
    if (dist(now, *it) <= n - dist(now, *it))
      printf("+%d\n", dist(now, *it));
    else
      printf("-%d\n", n - dist(now, *it));
    now = *it;
  }
}
int main() {
  scanf("%d%d", &n, &x);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), key[i] = a[i];
  sort(key + 1, key + n + 1);
  key[0] = -0x3f3f3f3f;
  for (int i = 1; i <= n; i++)
    if (key[i] != key[i - 1]) hs[++num] = key[i];
  for (int i = 1; i <= n; i++)
    a[i] = lower_bound(hs + 1, hs + num + 1, a[i]) - hs;
  for (int i = 1; i <= n; i++)
    if (i != x || a[i] != 1) pos[a[i]].push_back(i);
  memset(dp, 63, sizeof(dp));
  if (!pos[1].empty())
    dp[0][x] = 0;
  else
    dp[1][x] = 0;
  for (int i = 1; i <= num; i++)
    for (int j = 1; j <= n; j++) {
      if (i != 1 && a[j] != i - 1) continue;
      if (i == 1 && j != x) continue;
      solve(i, j);
    }
  int mn = 0x3f3f3f3f, pp = 0;
  for (int i = 1; i <= n; i++)
    if (mn > dp[num][i]) mn = dp[num][i], pp = i;
  printf("%d\n", mn);
  if (a[x] == 1) printf("+0\n");
  now = x;
  findway(num, pp);
  return 0;
}