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 MAXN = 2e3 + 10;
int n, s;
int a[MAXN], lisan[MAXN];
int f[MAXN], g[MAXN];
int to_g[MAXN];
vector<int> to_f[MAXN];
bool clwz[MAXN];
inline int dist(int x, int y) { return min(abs(x - y), n - abs(x - y)); }
inline int odist(int x, int y) { return (y - x + n) % n; }
inline int codist(int x, int y) { return (x - y + n) % n; }
inline vector<int> find(int val) {
  vector<int> res;
  res.clear();
  for (int i = 1; i <= n; i++)
    if (a[i] == val) res.push_back(i);
  return res;
}
inline void calc_g(int x) {
  vector<int> S = find(a[x] + 1);
  for (int i = 0; i < (int)S.size(); i++) {
    int pos = S[i];
    int val = f[pos] + dist(pos, x);
    if (val < g[x]) {
      g[x] = val;
      to_g[x] = pos;
    }
  }
}
inline void calc_f(int x) {
  vector<int> S = find(a[x]);
  if ((int)S.size() == 1) return f[x] = g[x], (void)0;
  sort(S.begin(), S.end());
  int px = lower_bound(S.begin(), S.end(), x) - S.begin();
  int lst = px - 1, nxt = px + 1;
  if (lst == -1) lst = (int)S.size() - 1;
  if (nxt == (int)S.size()) nxt = 0;
  int val1 = g[S[lst]] + odist(x, S[lst]);
  int val2 = g[S[nxt]] + odist(S[nxt], x);
  if (val1 < val2) {
    f[x] = val1;
    int cur = nxt;
    while (cur != px) {
      to_f[x].push_back(S[cur]);
      cur++;
      if (cur == (int)S.size()) cur = 0;
    }
    clwz[x] = true;
  } else {
    f[x] = val2;
    int cur = lst;
    while (cur != px) {
      to_f[x].push_back(S[cur]);
      cur--;
      if (cur == -1) cur = (int)S.size() - 1;
    }
    clwz[x] = false;
  }
}
inline void pt_dist(int x, int y) {
  int dis = dist(x, y);
  if ((x + dis - 1) % n + 1 == y)
    printf("+%d\n", dis);
  else
    printf("-%d\n", dis);
}
inline void pt_odist(int x, int y) {
  int odis = odist(x, y);
  printf("+%d\n", odis);
}
inline void pt_codist(int x, int y) {
  int codis = codist(x, y);
  printf("-%d\n", codis);
}
inline void print_ans(int x, bool flag) {
  if (!to_g[x] && flag) return;
  if (flag || (f[x] == g[x] && (int)to_f[x].size() == 0)) {
    if (to_g[x] == 0) return;
    pt_dist(x, to_g[x]);
    print_ans(to_g[x], 0);
  } else {
    int lst = x;
    int len = (int)to_f[x].size();
    for (int i = 0; i < len; i++) {
      int pos = to_f[x][i];
      if (clwz[x])
        pt_odist(lst, pos);
      else
        pt_codist(lst, pos);
      lst = pos;
    }
    print_ans(to_f[x][len - 1], 1);
  }
}
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), lisan[i] = a[i];
  sort(lisan + 1, lisan + n + 1);
  int p = unique(lisan + 1, lisan + n + 1) - lisan - 1;
  for (int i = 1; i <= n; i++)
    a[i] = lower_bound(lisan + 1, lisan + p + 1, a[i]) - lisan;
  int Mx = 0;
  for (int i = 1; i <= n; i++) Mx = max(Mx, a[i]);
  memset(f, 0x3f, sizeof(f));
  memset(g, 0x3f, sizeof(g));
  for (int i = 1; i <= n; i++)
    if (a[i] == Mx) g[i] = 0;
  for (int i = 1; i <= n; i++)
    if (a[i] == Mx) calc_f(i);
  for (int i = Mx - 1; i >= 1; i--) {
    vector<int> S = find(i);
    for (int j = 0; j < (int)S.size(); j++) calc_g(S[j]);
    for (int j = 0; j < (int)S.size(); j++) calc_f(S[j]);
  }
  vector<int> S = find(1);
  int ans = 1e9, ansp = -1;
  for (int i = 0; i < (int)S.size(); i++) {
    int pos = S[i];
    int val = f[pos] + dist(s, pos);
    if (ans > val) {
      ans = val;
      ansp = pos;
    }
  }
  printf("%d\n", ans);
  pt_dist(s, ansp);
  print_ans(ansp, 0);
  return 0;
}