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;
long long gcd(long long a, long long b) {
  long long r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long fpow(long long n, long long k, int p = (int)1e9 + 7) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = 2 * acos((long double)0);
const int maxn = 2010;
int n, s;
int a[maxn];
map<int, int> dc;
vector<int> g[maxn];
int f[maxn];
pair<pair<int, int>, int> rb[maxn];
int dist(int i, int j) { return min(abs(i - j), n - abs(i - j)); }
int dist2(int i, int j) {
  int res = j - i;
  if (res <= 0) res += n;
  return res;
}
vector<int> trace(int p, int q, int dir) {
  vector<int> res;
  res.push_back(q);
  if (dir == 1) {
    while (q != p) {
      q = (q + 1) % n;
      if (a[q] == a[p]) {
        res.push_back(q);
      }
    }
  } else {
    while (q != p) {
      q = (q + n - 1) % n;
      if (a[q] == a[p]) {
        res.push_back(q);
      }
    }
  }
  return res;
}
void solve() {
  scanf("%d%d", &n, &s);
  s--;
  for (int i = (0); i < (n); i++) {
    scanf("%d", a + i);
    dc[a[i]];
  }
  int cnt = 0;
  for (__typeof((dc).begin()) it = (dc).begin(); it != (dc).end(); it++)
    it->second = cnt++;
  for (int i = (0); i < (n); i++) {
    a[i] = dc[a[i]];
    g[a[i]].push_back(i);
  }
  memset(f, 0x3f, sizeof(f));
  for (int i = (0); i < (int((g[0]).size())); i++) {
    int u = g[0][i];
    f[u] = dist(s, u);
    rb[u] = make_pair(make_pair(-1, s), 0);
  }
  for (int i = (1); i < (cnt); i++) {
    for (int j = (0); j < (int((g[i]).size())); j++) {
      int u = g[i][j];
      for (int k = (0); k < (int((g[i - 1]).size())); k++) {
        int p = g[i - 1][k];
        int q = g[i - 1][(k + 1) % int((g[i - 1]).size())];
        int d = dist2(p, q);
        int x = f[p] + n - dist2(p, q) + dist(u, q);
        int y = f[q] + n - dist2(p, q) + dist(u, p);
        if (f[u] > x) {
          f[u] = x;
          rb[u] = make_pair(make_pair(p, q), 1);
        }
        if (f[u] > y) {
          f[u] = y;
          rb[u] = make_pair(make_pair(q, p), -1);
        }
      }
    }
  }
  int ans = INF, r1, r2, dir;
  for (int i = (0); i < (int((g[cnt - 1]).size())); i++) {
    int p = g[cnt - 1][i];
    int q = g[cnt - 1][(i + 1) % int((g[cnt - 1]).size())];
    int x = f[p] + n - dist2(p, q);
    int y = f[q] + n - dist2(p, q);
    if (ans > x) {
      ans = x;
      r1 = p;
      r2 = q;
      dir = 1;
    }
    if (ans > y) {
      ans = y;
      r1 = q;
      r2 = p;
      dir = -1;
    }
  }
  printf("%d\n", ans);
  vector<int> res;
  for (int _ = (0); _ < (cnt); _++) {
    vector<int> r = trace(r1, r2, dir);
    for (int i = (0); i < (int((r).size())); i++) res.push_back(r[i]);
    pair<pair<int, int>, int> p = rb[r1];
    r1 = p.first.first;
    r2 = p.first.second;
    dir = p.second;
  }
  res.push_back(r2);
  reverse((res).begin(), (res).end());
  for (int i = (0); i < (int((res).size()) - 1); i++) {
    if (res[i] <= res[i + 1] && res[i + 1] - res[i] == dist(res[i], res[i + 1]))
      printf("+");
    else if (res[i] >= res[i + 1] &&
             res[i] - res[i + 1] != dist(res[i], res[i + 1]))
      printf("+");
    else
      printf("-");
    printf("%d\n", dist(res[i], res[i + 1]));
  }
}
int main() {
  solve();
  return 0;
}