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 inf = 1e9;
int n, s, a[2010], pre[2010], nxt[2010], b[2010], k, f[2010][2];
vector<int> v[2010];
pair<int, int> from[2010][2];
int dis(int first, int second) {
  int res = abs(first - second);
  res = min(res, n - res);
  return res;
}
int get(int i, int j, int t, int first, int second,
        vector<pair<int, int> > &g) {
  int cnt = 0, res = 0, now = 0;
  g.clear();
  while (true) {
    if (a[i] == first || i == j) {
      if (a[i] == first) {
        cnt++;
      }
      g.push_back(make_pair(now, t));
      now = 0;
    }
    if (i == j) {
      break;
    }
    res++;
    now++;
    i += t;
    if (i < 0) {
      i += n;
    }
    if (i >= n) {
      i -= n;
    }
  }
  if (cnt < second) {
    return inf;
  } else {
    return res;
  }
}
int main() {
  scanf("%d%d", &n, &s);
  s--;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    b[++k] = a[i];
  }
  sort(b + 1, b + k + 1);
  k = unique(b + 1, b + k + 1) - b - 1;
  for (int i = 0; i < n; i++) {
    a[i] = lower_bound(b + 1, b + k + 1, a[i]) - b;
    v[a[i]].push_back(i);
  }
  for (int i = 1; i <= k; i++) {
    int sz = v[i].size();
    for (int j = 0; j < sz; j++) {
      pre[v[i][j]] = v[i][(j + sz - 1) % sz];
      nxt[v[i][j]] = v[i][(j + 1) % sz];
    }
  }
  for (int i = 0; i < n; i++) {
    f[i][0] = f[i][1] = inf;
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 1) {
      f[i][0] = dis(s, i);
    }
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 0; j < v[i].size(); j++) {
      int first = v[i][j];
      int l = pre[first];
      int r = nxt[first];
      if (l == first) {
        if (f[first][0] < f[first][1]) {
          f[first][1] = f[first][0];
          from[first][1] = make_pair(first, 0);
        }
      }
      int dl, dr;
      if (l < first) {
        dl = first - l;
      } else {
        dl = first + n - l;
      }
      if (r > first) {
        dr = r - first;
      } else {
        dr = r + n - first;
      }
      if (f[l][1] > f[first][0] + (n - dl)) {
        f[l][1] = f[first][0] + (n - dl);
        from[l][1] = make_pair(first, 0);
      }
      if (f[r][1] > f[first][0] + (n - dr)) {
        f[r][1] = f[first][0] + (n - dr);
        from[r][1] = make_pair(first, 0);
      }
    }
    for (int j = 0; j < v[i].size(); j++) {
      int first = v[i][j];
      for (int k = 0; k < v[i + 1].size(); k++) {
        int second = v[i + 1][k];
        int d = dis(first, second);
        if (f[second][0] > f[first][1] + d) {
          f[second][0] = f[first][1] + d;
          from[second][0] = make_pair(first, 1);
        }
      }
    }
  }
  int ans = inf, qi, qj;
  vector<pair<int, int> > g;
  for (int i = 0; i < n; i++) {
    if (a[i] == k) {
      if (f[i][1] < ans) {
        ans = f[i][1];
        qi = i;
        qj = 1;
      }
    }
  }
  printf("%d\n", ans);
  while (a[qi] > 1 || qj) {
    pair<int, int> u = from[qi][qj];
    int first, second;
    if (!qj && u.second) {
      first = 0;
      second = 0;
    } else {
      first = a[qi];
      second = v[a[qi]].size();
    }
    vector<pair<int, int> > v1, v2;
    int c1 = get(u.first, qi, 1, first, second, v1);
    int c2 = get(u.first, qi, -1, first, second, v2);
    reverse(v1.begin(), v1.end());
    reverse(v2.begin(), v2.end());
    if (c1 < c2) {
      for (int i = 0; i < v1.size(); i++) {
        g.push_back(v1[i]);
      }
    } else {
      for (int i = 0; i < v2.size(); i++) {
        g.push_back(v2[i]);
      }
    }
    qi = u.first;
    qj = u.second;
  }
  int first = 0, second = 0;
  vector<pair<int, int> > v1, v2;
  int c1 = get(s, qi, 1, first, second, v1);
  int c2 = get(s, qi, -1, first, second, v2);
  reverse(v1.begin(), v1.end());
  reverse(v2.begin(), v2.end());
  if (c1 < c2) {
    for (int i = 0; i < v1.size(); i++) {
      g.push_back(v1[i]);
    }
  } else {
    for (int i = 0; i < v2.size(); i++) {
      g.push_back(v2[i]);
    }
  }
  reverse(g.begin(), g.end());
  for (int i = 0; i < g.size(); i++) {
    if (i && !g[i].first) {
      continue;
    }
    if (g[i].second == 1) {
      putchar('+');
    } else {
      putchar('-');
    }
    printf("%d\n", g[i].first);
  }
  return 0;
}