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 = 2005;
int dp[maxn][maxn];
int from[maxn];
pair<int, int> way[maxn][maxn];
vector<int> pos[maxn];
vector<pair<int, int> > num;
int n, s;
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    num.push_back(make_pair(a, i));
  }
  sort(num.begin(), num.end());
  int tmax = -1e9 - 5;
  int t = 0;
  for (int i = 0; i < num.size(); i++) {
    if (num[i].first > tmax) {
      tmax = num[i].first;
      t++;
    }
    pos[t].push_back(num[i].second);
  }
  memset(dp, 0x3f, sizeof dp);
  dp[0][s] = 0;
  pos[0].push_back(s);
  for (int i = 1; i <= t; i++) {
    if (pos[i].size() == 1) {
      for (int k = 0; k < pos[i - 1].size(); k++) {
        int des = pos[i][0];
        int start = pos[i - 1][0];
        int dis = min(abs(start - des), n - abs(start - des));
        if (dp[i][des] > dp[i - 1][start] + dis) {
          dp[i][des] = dp[i - 1][start] + dis;
          from[des] = start;
          if (((start + dis - 1) % n) + 1 == des)
            way[i][des] = make_pair(dis, -1);
          else
            way[i][des] = make_pair(-dis, -1);
        }
      }
    }
    for (int j = 0; j < pos[i].size(); j++) {
      int des = pos[i][j];
      int npos1 = pos[i][(j - 1 + pos[i].size()) % pos[i].size()],
          npos2 = pos[i][(j + 1) % pos[i].size()];
      int od1 = (des < npos1 ? (npos1 - des) : (npos1 - des + n));
      int od2 = (des < npos2 ? (des - npos2 + n) : (des - npos2));
      for (int k = 0; k < pos[i - 1].size(); k++) {
        int start = pos[i - 1][k];
        int dis1 = min(abs(start - npos1), n - abs(start - npos1));
        int dis2 = min(abs(start - npos2), n - abs(start - npos2));
        if (dp[i][des] > dp[i - 1][start] + dis1 + od1) {
          dp[i][des] = dp[i - 1][start] + dis1 + od1;
          from[des] = start;
          if (((start + dis1 - 1) % n + 1) == npos1)
            way[i][des] = make_pair(dis1, 0);
          else
            way[i][des] = make_pair(-dis1, 0);
        }
        if (dp[i][des] > dp[i - 1][start] + dis2 + od2) {
          dp[i][des] = dp[i - 1][start] + dis2 + od2;
          from[des] = start;
          if (((start + dis2 - 1) % n + 1) == npos2)
            way[i][des] = make_pair(dis2, 1);
          else
            way[i][des] = make_pair(-dis2, 1);
        }
      }
    }
  }
  int ans = 1e9;
  int te = 0;
  vector<vector<int> > op;
  for (int i = 0; i < pos[t].size(); i++) {
    if (ans > dp[t][pos[t][i]]) {
      ans = dp[t][pos[t][i]];
      te = pos[t][i];
    }
  }
  for (int i = t; i >= 1; i--) {
    vector<int> tmp;
    int start = from[te];
    if (i == 7) {
      int as = 2;
    }
    pair<int, int> w = way[i][te];
    tmp.push_back(w.first);
    if (w.second != -1) {
      int index = lower_bound(pos[i].begin(), pos[i].end(),
                              (w.first + start - 1 + n) % n + 1) -
                  pos[i].begin();
      for (int k = 0; k < pos[i].size() - 1; k++) {
        if (w.second == 1) {
          int id1 = (index + k) % pos[i].size(),
              id2 = (index + k + 1) % pos[i].size();
          int dis = pos[i][id2] - pos[i][id1];
          if (dis < 0) dis += n;
          tmp.push_back(dis);
        } else if (w.second == 0) {
          int id1 = (index - k + pos[i].size()) % pos[i].size(),
              id2 = (index - k - 1 + pos[i].size()) % pos[i].size();
          int dis = pos[i][id1] - pos[i][id2];
          if (dis < 0) dis += n;
          tmp.push_back(-dis);
        }
      }
    }
    op.push_back(tmp);
    te = start;
  }
  cout << ans << endl;
  for (int i = op.size() - 1; i >= 0; i--) {
    for (int j = 0; j < op[i].size(); j++) {
      if (op[i][j] >= 0) printf("+");
      printf("%d\n", op[i][j]);
    }
  }
  return 0;
}