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;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
const int N = 2005;
int INF = INT_MAX / 3;
int n;
int a[N];
int dpin[N];
int dpout[N];
int into[N];
int outto[N];
bool cwin[N];
bool cwout[N];
map<int, int> npos;
int solveout(int pos);
int dist(int aa, int bb) {
  int mdist = abs(aa - bb);
  return min(mdist, n - mdist);
}
int solvein(int pos) {
  if (dpin[pos] != -1) return dpin[pos];
  int next = (pos + 1) % n, nsteps = 1;
  while (a[next] != a[pos]) {
    next++;
    if (next >= n) next -= n;
    nsteps++;
  }
  if (next == pos) {
    into[pos] = pos;
    return solveout(pos);
  }
  int prev = (pos - 1 + n) % n, psteps = 1;
  while (a[prev] != a[pos]) {
    prev--;
    if (prev < 0) prev += n;
    psteps++;
  }
  int opt1 = solveout(next) + n - nsteps;
  int opt2 = solveout(prev) + n - psteps;
  if (opt1 < opt2) {
    into[pos] = next;
    cwin[pos] = false;
    return opt1;
  } else {
    into[pos] = prev;
    cwin[pos] = true;
    return opt2;
  }
}
inline bool iscw(int pos, int end) {
  int r = pos + dist(pos, end);
  if (r >= n) r -= n;
  return r == end;
}
int find_next(int pos) { return npos[a[pos]]; }
int solveout(int pos) {
  if (dpout[pos] != -1) return dpout[pos];
  int next = find_next(pos);
  if (next == -INF) {
    outto[pos] = -1;
    return 0;
  }
  int best = INF, bestidx = -1;
  for (int i = 0; i < n; i++) {
    if (a[i] == next) {
      int ans = solvein(i) + dist(pos, i);
      if (ans < best) {
        best = ans;
        bestidx = i;
      }
    }
  }
  assert(best != INF);
  cwout[pos] = iscw(pos, bestidx);
  outto[pos] = bestidx;
  return dpout[pos] = best;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int start;
  cin >> n >> start;
  start--;
  vector<int> opts;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    opts.push_back(a[i]);
  }
  sort(opts.begin(), opts.end());
  for (int i = 1; i < n; i++) {
    if (opts[i] != opts[i - 1]) {
      npos[opts[i - 1]] = opts[i];
    }
  }
  npos[opts[opts.size() - 1]] = -INF;
  int first = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] < a[first]) first = i;
  }
  fill_n(dpin, n, -1);
  fill_n(dpout, n, -1);
  int ans = INF, startidx = -1;
  for (int i = 0; i < n; i++) {
    if (a[i] == a[first]) {
      int curr = solvein(i) + dist(start, i);
      if (curr < ans) {
        ans = curr;
        startidx = i;
      }
    }
  }
  assert(ans != INF);
  cout << ans << '\n';
  if (iscw(start, startidx))
    cout << '+';
  else
    cout << '-';
  cout << dist(start, startidx) << '\n';
  int pos = startidx;
  while (true) {
    int end = into[pos];
    int ch = cwin[pos] ? 1 : -1;
    char d = cwin[pos] ? '+' : '-';
    int pp = pos;
    while (pos != end) {
      pos += ch;
      if (pos < 0) pos += n;
      if (pos >= n) pos -= n;
      if (a[pos] == a[end]) {
        cout << d << dist(pp, pos) << '\n';
        pp = pos;
      }
    }
    if (outto[pos] == -1) break;
    if (cwout[pos])
      cout << "+";
    else
      cout << "-";
    cout << dist(pos, outto[pos]) << '\n';
    pos = outto[pos];
  }
}