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;
template <class T>
inline void amin(T &a, const T &b) {
  if (b < a) a = b;
}
template <class T>
inline void amax(T &a, const T &b) {
  if (a < b) a = b;
}
template <class T>
vector<int> compress(const vector<T> &v, vector<T> *unq = NULL) {
  int n = v.size();
  vector<pair<T, int> > t(n);
  for (int i = 0; i < n; i++) t[i] = make_pair(v[i], i);
  sort(t.begin(), t.end());
  vector<int> r(n);
  int cur = 0;
  for (int i = 0, k = 0; i < n; i++) {
    if (t[k].first < t[i].first) k = i, cur++;
    r[t[i].second] = cur;
  }
  if (unq) {
    unq->resize(cur + 1);
    cur = 0;
    for (int i = 0; i < n; i++)
      if (i == 0 || t[i - 1].first < t[i].first) (*unq)[cur++] = t[i].first;
  }
  return r;
}
int N, S;
int A[2011];
vector<int> G[2011];
int INF;
int dp[2011][2011];
int from[2011][2011], start[2011][2011];
int cost(int a, int b) { return min(abs(a - b), N - abs(a - b)); }
int main() {
  scanf("%d%d", &N, &S);
  S--;
  for (int i = 0, i_len = (N); i < i_len; ++i) scanf("%d", A + i);
  vector<int> C = compress(vector<int>(A, A + N));
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    G[C[i]].push_back(i);
  }
  memset(dp, 0x3f, sizeof dp);
  memset(&INF, 0x3f, sizeof INF);
  dp[0][S] = 0;
  int cur = 0;
  for (int i = 0, i_len = (N); i < i_len; ++i)
    if (G[i].size()) {
      sort(G[i].begin(), G[i].end());
      for (int k = 0, k_len = (N); k < k_len; ++k)
        if (dp[cur][k] != INF) {
          int sz = G[i].size();
          for (int j = 0, j_len = (G[i].size()); j < j_len; ++j) {
            int K[2] = {G[i][(j + sz - 1) % sz], G[i][(j + 1) % sz]};
            for (int z = 0, z_len = (2); z < z_len; ++z) {
              int cst = cost(k, G[i][j]);
              if (G[i].size() == 1u)
                ;
              else if (G[i].size() == 2u)
                cst += cost(G[i][j], K[z]);
              else if (z == 0)
                cst += N - (G[i][j] - K[z] + N) % N;
              else
                cst += N - (K[z] - G[i][j] + N) % N;
              if (dp[cur + 1][K[z]] > cst + dp[cur][k]) {
                dp[cur + 1][K[z]] = cst + dp[cur][k];
                from[cur + 1][K[z]] = k;
                start[cur + 1][K[z]] = G[i][j];
              }
            }
          }
        }
      cur++;
    }
  int T = 0;
  for (int i = 0, i_len = (N); i < i_len; ++i)
    if (dp[cur][T] > dp[cur][i]) {
      T = i;
    }
  printf("%d\n", dp[cur][T]);
  vector<int> ans;
  for (int i = N; i--;) {
    if (G[i].size() == 0u) continue;
    int sz = G[i].size();
    for (int j = 0, j_len = (G[i].size()); j < j_len; ++j) {
      if (G[i][j] == T) {
        int d = 0;
        if (G[i][(j + 1) % sz] == start[cur][T]) {
          d = -1;
        } else {
          d = +1;
        }
        int jj = j;
        for (int p = 0, p_len = (sz); p < p_len; ++p) {
          ans.push_back(G[i][jj]);
          jj = (jj + d + sz) % sz;
        }
        T = from[cur][T];
        break;
      }
    }
    cur--;
  }
  assert(T == S);
  ans.push_back(S);
  reverse(ans.begin(), ans.end());
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    int a[] = {(ans[i + 1] - ans[i] + N) % N, (ans[i] - ans[i + 1] + N) % N};
    if (a[0] <= a[1])
      printf("+%d\n", a[0]);
    else
      printf("-%d\n", a[1]);
  }
  return 0;
}