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 MX = 2005;
int n, s, mem1[MX][2], a[MX], mem2[MX][MX][2], in[MX];
vector<long long> c, pos[MX];
int go(int i, int j, int f = 0) {
  int x = (j - i + n) % n;
  if (f)
    if (x < n - x)
      cout << "+" << x << '\n';
    else
      cout << "-" << n - x << '\n';
  return min(x, n - x);
}
int dp2(int i, int j, int f);
int dp1(int i, int f) {
  if (a[i] + 1 == c.size() && f) return 0;
  int &res = mem1[i][f];
  if (res != -1) return res;
  res = 1e9;
  if (f) {
    for (int j = 0; j < n; j++)
      if (a[j] == a[i] + 1) res = min(res, dp1(j, 0) + go(i, j));
  } else {
    res = dp2(i, i, 0);
  }
  return res;
}
int dp2(int i, int j, int f) {
  int x = in[i];
  int y = in[j];
  int m = pos[a[i]].size();
  if ((y - x + m) % m + 1 == m) return f ? dp1(j, 1) : dp1(i, 1);
  int &res = mem2[i][j][f];
  if (res != -1) return res;
  res = 1e9;
  int ni = pos[a[i]][(x - 1 + m) % m];
  int nj = pos[a[i]][(y + 1) % m];
  int from = f ? j : i;
  res = min(res, dp2(ni, j, 0) + go(from, ni));
  res = min(res, dp2(i, nj, 1) + go(from, nj));
  return res;
}
void rec2(int i, int j, int f);
void rec1(int i, int f) {
  if (a[i] + 1 == c.size() && f) return;
  if (f) {
    for (int j = 0; j < n; j++)
      if (a[j] == a[i] + 1) {
        if (dp1(j, 0) + go(i, j) == dp1(i, f)) {
          go(i, j, 1);
          return rec1(j, 0);
        }
      }
  } else {
    return rec2(i, i, 0);
  }
}
void rec2(int i, int j, int f) {
  int x = in[i], y = in[j];
  int m = pos[a[i]].size();
  if ((y - x + m) % m + 1 == m) return f ? rec1(j, 1) : rec1(i, 1);
  int ni = pos[a[i]][(x - 1 + m) % m];
  int nj = pos[a[i]][(y + 1) % m];
  int from = f ? j : i;
  if (dp2(ni, j, 0) + go(from, ni) == dp2(i, j, f)) {
    go(from, ni, 1);
    return rec2(ni, j, 0);
  }
  if (dp2(i, nj, 1) + go(from, nj) == dp2(i, j, f)) {
    go(from, nj, 1);
    return rec2(i, nj, 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  memset(mem1, -1, sizeof(mem1));
  memset(mem2, -1, sizeof(mem2));
  cin >> n >> s;
  s--;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    c.push_back(a[i]);
  }
  sort(c.begin(), c.end());
  c.erase(unique(c.begin(), c.end()), c.end());
  for (int i = 0; i < n; i++) {
    a[i] = lower_bound(c.begin(), c.end(), a[i]) - c.begin();
    in[i] = pos[a[i]].size();
    pos[a[i]].push_back(i);
  }
  int ind, mn = 1e9;
  for (int i = 0; i < n; i++)
    if (!a[i]) {
      int p = dp1(i, 0) + go(s, i);
      if (p < mn) {
        mn = p;
        ind = i;
      }
    }
  cout << mn << '\n';
  go(s, ind, 1);
  rec1(ind, 0);
  return 0;
}