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;
const long long INF_LL = 4e18;
const double pi = acos(-1.0);
template <class T>
T& smin(T& x, const T& y) {
  if (x > y) x = y;
  return x;
}
template <class T>
T& smax(T& x, const T& y) {
  if (x < y) x = y;
  return x;
}
template <class T>
T sqr(const T& x) {
  return x * x;
}
template <typename Iterator>
void print(const char* fmt, Iterator begin, Iterator end,
           const char* delimiter = " ", const char* closing = "\n") {
  for (; begin != end; ++begin != end ? printf("%s", delimiter) : 0)
    printf(fmt, *begin);
  printf("%s", closing);
}
const int N = 2001;
int n, s;
pair<int, int> a[N];
vector<int> b;
inline int dist(int i, int j) {
  int l = abs(i - j);
  return min(l, n - l);
}
struct S {
  int t;
  int u, x, y, cl;
  S(int t0 = INF) : t(t0) {}
  void upd(int tt, int uu, int xx, int yy, int ccl) {
    if (t > tt) t = tt, u = uu, x = xx, y = yy, cl = ccl;
  }
};
vector<vector<vector<vector<S>>>> d;
void outp(int i, int j) {
  int cl = j - i;
  if (cl < 0) cl += n;
  int ccl = i - j;
  if (ccl < 0) ccl += n;
  if (cl <= ccl)
    printf("+%d\n", cl);
  else
    printf("-%d\n", ccl);
}
inline int trim(int x, int k) {
  if (x < 0) return x + k;
  if (x >= k) return x - k;
  return x;
}
void answer() {
  vector<int> o;
  int t = INF, u = int((d).size()) - 1, x, y, cl;
  int k = b.back() - b[int((b).size()) - 2];
  for (int j(0), _b(k); j < _b; ++j) {
    if (d[u][j][trim(j + 1, k)][0].t < t)
      t = d[u][j][trim(j + 1, k)][0].t, x = j, y = trim(j + 1, k), cl = 0;
    if (d[u][j][trim(j - 1, k)][1].t < t)
      t = d[u][j][trim(j - 1, k)][1].t, x = j, y = trim(j - 1, k), cl = 1;
  }
  printf("%d\n", t);
  while (u != -1) {
    o.push_back(a[b[u] + x].second);
    const S& c = d[u][x][y][cl];
    u = c.u;
    x = c.x;
    y = c.y;
    cl = c.cl;
  }
  o.push_back(s);
  reverse((o).begin(), (o).end());
  for (int i(0), _b(int((o).size()) - 1); i < _b; ++i) outp(o[i], o[i + 1]);
}
int main() {
  cin.tie(NULL);
  scanf("%d%d", &n, &s);
  --s;
  for (int i(0), _b(n); i < _b; ++i) {
    scanf("%d", &a[i].first);
    a[i].second = i;
  }
  sort(a, a + n);
  b = {0};
  for (int i(1), _b(n + 1); i < _b; ++i)
    if (i == n || a[i - 1].first != a[i].first) {
      int u = int((d).size());
      int l = b.back(), k = i - l;
      d.push_back(
          vector<vector<vector<S>>>(k, vector<vector<S>>(k, vector<S>(2))));
      for (int j(0), _b(k); j < _b; ++j) {
        if (u == 0) {
          d[u][j][j][0].upd(dist(a[l + j].second, s), -1, 0, 0, 0);
        } else {
          int pl = b[int((b).size()) - 2], pk = l - pl;
          for (int p(0), _b(pk); p < _b; ++p) {
            int y0 = trim(p + 1, pk), y1 = trim(p - 1, pk);
            d[u][j][j][0].upd(
                d[u - 1][p][y0][0].t + dist(a[l + j].second, a[pl + p].second),
                u - 1, p, y0, 0);
            d[u][j][j][0].upd(
                d[u - 1][p][y1][1].t + dist(a[l + j].second, a[pl + p].second),
                u - 1, p, y1, 1);
          }
        }
        const S& c = d[u][j][j][0];
        d[u][j][j][1].upd(c.t, c.u, c.x, c.y, c.cl);
      }
      for (int r(0), _b(k - 1); r < _b; ++r) {
        for (int j(0), _b(k); j < _b; ++j) {
          int y0 = trim(j - r, k), y1 = trim(j + r, k), w;
          w = trim(j + 1, k);
          d[u][w][y0][0].upd(
              d[u][j][y0][0].t + dist(a[l + j].second, a[l + w].second), u, j,
              y0, 0);
          w = trim(y0 - 1, k);
          d[u][w][j][1].upd(
              d[u][j][y0][0].t + dist(a[l + j].second, a[l + w].second), u, j,
              y0, 0);
          w = trim(j - 1, k);
          d[u][w][y1][1].upd(
              d[u][j][y1][1].t + dist(a[l + j].second, a[l + w].second), u, j,
              y1, 1);
          w = trim(y1 + 1, k);
          d[u][w][j][0].upd(
              d[u][j][y1][1].t + dist(a[l + j].second, a[l + w].second), u, j,
              y1, 1);
        }
      }
      b.push_back(i);
    }
  answer();
  return 0;
}