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>
#pragma warning(disable : 4996)
using namespace std;
int n, s, m;
int a[3000];
map<int, int> mq;
int d[2005][2005];
pair<int, int> p[2005][2005];
vector<int> path;
int check[3000];
int u[3000];
int mod(int x) {
  x %= n;
  return x >= 0 ? x : n + x;
}
int clock(int from, int to) { return mod(to - from); }
int coclock(int from, int to) { return mod(from - to); }
int dist(int from, int to) { return min(clock(from, to), coclock(from, to)); }
int main() {
  int i, j, k;
  cin >> n >> s;
  for (i = 0; i < n; i++) scanf("%d", &a[i]), mq[a[i]] = 0;
  for (auto &e : mq) e.second = m++;
  for (i = 0; i < n; i++) a[i] = mq[a[i]], u[a[i]]++;
  memset(d, 0x3f, sizeof(d));
  d[0][s - 1] = 0;
  p[0][s - 1] = pair<int, int>(-1, -1);
  for (j = 0; j < 3 * n; j++) {
    if (d[0][mod(j)] > d[0][mod(j - 1)] + 1)
      d[0][mod(j)] = d[0][mod(j - 1)] + 1,
      p[0][mod(j)] = pair<int, int>(mod(j - 1), 2);
  }
  for (j = 3 * n - 1; j >= 0; j--) {
    if (d[0][mod(j)] > d[0][mod(j + 1)] + 1)
      d[0][mod(j)] = d[0][mod(j + 1)] + 1,
      p[0][mod(j)] = pair<int, int>(mod(j + 1), 3);
  }
  for (i = 0; i < m; i++) {
    int past, next, cnt = 0;
    for (j = 0; j < n; j++)
      if (a[j] == i) cnt++;
    for (j = n - 1; j >= 0; j--) {
      if (a[j] == i) {
        past = j;
        break;
      }
    }
    for (j = 0; j < n; j++) {
      if (a[j] == i) {
        next = j;
        break;
      }
    }
    if (past == next) {
      for (j = 0; j < n; j++) {
        if (d[i + 1][next] > d[i][j] + clock(j, next))
          d[i + 1][next] = d[i][j] + clock(j, next),
                p[i + 1][next] = pair<int, int>(j, 0);
        if (d[i + 1][next] > d[i][j] + coclock(j, next))
          d[i + 1][next] = d[i][j] + coclock(j, next),
                p[i + 1][next] = pair<int, int>(j, 1);
      }
    } else {
      for (j = 0; j < n; j++) {
        if (d[i + 1][past] > d[i][j] + clock(j, past))
          d[i + 1][past] = d[i][j] + clock(j, past),
                p[i + 1][past] = pair<int, int>(j, 0);
        if (a[j] == i) {
          past = j;
          for (next++, next %= n;; next++, next %= n) {
            if (a[next] == i) break;
          }
        }
        if (d[i + 1][next] > d[i][j] + coclock(j, next))
          d[i + 1][next] = d[i][j] + coclock(j, next),
                p[i + 1][next] = pair<int, int>(j, 1);
      }
    }
    for (j = 0; j < 3 * n; j++) {
      if (d[i + 1][mod(j)] > d[i + 1][mod(j - 1)] + 1)
        d[i + 1][mod(j)] = d[i + 1][mod(j - 1)] + 1,
              p[i + 1][mod(j)] = pair<int, int>(mod(j - 1), 2);
    }
    for (j = 3 * n - 1; j >= 0; j--) {
      if (d[i + 1][mod(j)] > d[i + 1][mod(j + 1)] + 1)
        d[i + 1][mod(j)] = d[i + 1][mod(j + 1)] + 1,
              p[i + 1][mod(j)] = pair<int, int>(mod(j + 1), 3);
    }
  }
  int mi = ((1 << 30) - 1), mii;
  for (i = 0; i < n; i++)
    if (mi > d[m][i]) mi = d[m][i], mii = i;
  printf("%d\n", mi);
  int nowi = m, nowj = mii;
  while (1) {
    if (p[nowi][nowj] == pair<int, int>(-1, -1)) break;
    if (p[nowi][nowj].second % 2 == 0)
      for (i = 0; i < clock(p[nowi][nowj].first, nowj); i++) path.push_back(1);
    else
      for (i = 0; i < coclock(p[nowi][nowj].first, nowj); i++)
        path.push_back(-1);
    tie(nowi, nowj) = pair<int, int>(nowi - 1 + p[nowi][nowj].second / 2,
                                     p[nowi][nowj].first);
  }
  reverse((path).begin(), (path).end());
  int now = s - 1;
  int past = 0, dir = 0;
  int tar = 0;
  vector<pair<int, int> > ans;
  path.push_back(0);
  for (i = 0; i < path.size(); i++) {
    if (!check[now] && a[now] == tar) {
      ans.push_back(pair<int, int>(dir, i - past));
      past = i;
      check[now] = 1;
      u[tar]--;
      if (!u[tar]) tar++;
    }
    now = mod(now + path[i]);
    if (path[i] == 1)
      dir = 0;
    else
      dir = -1;
  }
  for (auto e : ans) printf("%s%d\n", e.first == 0 ? "+" : "-", e.second);
  return 0;
}