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;
long long inf = 1e18;
int n, s;
long long a[2010];
vector<vector<int>> g;
long long d[2010][2010];
long long dp[2010][2];
pair<int, int> rt[2010][2];
int pre[2010];
int nxt[2010];
vector<long long> rec;
void mkgroup() {
  map<long long, vector<int>> mp;
  for (int i = 0; i < n; i++) mp[a[i]].push_back(i);
  int cnt = 0;
  for (auto p : mp) g.push_back(p.second);
}
void calcd() {
  for (int idl = 0; idl < n; idl++) {
    d[idl][idl] = 0;
    for (int idr = idl + 1; idr < n; idr++) {
      d[idl][idr] = idr - idl;
      d[idr][idl] = n - d[idl][idr];
    }
  }
}
void initID() {
  for (int i = 0; i < g.size(); i++) {
    for (int j = 0; j < g[i].size(); j++) {
      int ps1 = g[i][j];
      int ps2 = g[i][(j + 1) % g[i].size()];
      nxt[ps1] = ps2;
      pre[ps2] = ps1;
    }
  }
}
void revin(int p, int dir) {
  int prep = p, nxtp;
  vector<long long> v;
  if (dir == 1) {
    nxtp = nxt[prep];
  } else {
    nxtp = pre[prep];
  }
  while (nxtp != p) {
    long long D = d[prep][nxtp];
    v.push_back(dir * min(D, n - D));
    prep = nxtp;
    if (dir == 1) {
      nxtp = nxt[prep];
    } else {
      nxtp = pre[prep];
    }
  }
  for (int i = v.size() - 1; i >= 0; i--) rec.push_back(v[i]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  s--;
  for (int i = 0; i < n; i++) cin >> a[i];
  mkgroup();
  calcd();
  initID();
  for (int i = 0; i < n; i++) dp[i][0] = dp[i][1] = inf;
  for (int i = 0; i < g[0].size(); i++) {
    int ps = g[0][i];
    long long D = d[s][ps];
    if (D > n - D) {
      dp[ps][0] = n - D;
      rt[ps][0] = {s, -1};
    } else {
      dp[ps][0] = D;
      rt[ps][0] = {s, 1};
    }
  }
  for (int i = 0; i < g.size(); i++) {
    for (int j = 0; j < g[i].size(); j++) {
      int ps = g[i][j];
      long long dpre = dp[pre[ps]][0] + d[ps][pre[ps]];
      long long dnxt = dp[nxt[ps]][0] + d[nxt[ps]][ps];
      if (dpre < dp[ps][1]) {
        dp[ps][1] = dpre;
        rt[ps][1] = {pre[ps], -1};
      }
      if (dnxt < dp[ps][1]) {
        dp[ps][1] = dnxt;
        rt[ps][1] = {nxt[ps], 1};
      }
    }
    if (i == g.size() - 1) break;
    for (int j = 0; j < g[i].size(); j++) {
      int ps1 = g[i][j];
      for (int k = 0; k < g[i + 1].size(); k++) {
        int ps2 = g[i + 1][k];
        long long D = d[ps1][ps2];
        if (dp[ps2][0] > dp[ps1][1] + D) {
          dp[ps2][0] = dp[ps1][1] + D;
          rt[ps2][0] = {ps1, 1};
        }
        if (dp[ps2][0] > dp[ps1][1] + (n - D)) {
          dp[ps2][0] = dp[ps1][1] + (n - D);
          rt[ps2][0] = {ps1, -1};
        }
      }
    }
  }
  long long ans = inf;
  int pnt, dir;
  for (int i = 0; i < g[g.size() - 1].size(); i++) {
    int ps = g[g.size() - 1][i];
    if (ans > dp[ps][1]) {
      ans = dp[ps][1];
      pnt = ps;
    }
  }
  cout << ans << endl;
  for (int i = g.size() - 1; i >= 0; i--) {
    dir = rt[pnt][1].second;
    pnt = rt[pnt][1].first;
    revin(pnt, dir);
    dir = rt[pnt][0].second;
    long long D = d[pnt][rt[pnt][0].first];
    pnt = rt[pnt][0].first;
    rec.push_back(dir * min(D, n - D));
  }
  reverse(rec.begin(), rec.end());
  for (int i = 0; i < rec.size(); i++) {
    if (rec[i] >= 0) cout << "+";
    cout << rec[i] << endl;
  }
  return 0;
}