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 INF = (int)1e8 + 10;
int length, initPos;
long long sum = 0;
long long tmpSum = INF;
vector<int> dp;
vector<pair<int, int>> seq;
vector<vector<pair<int, int>>> seqVector;
vector<vector<int>> xx;
int getDistance(int x, int y) {
  int d = (length + y - x) % length;
  if (d > length - d) d -= length;
  return d;
}
int getWidth(int x, int y) {
  int w = y - x;
  if (w < 0) w += length;
  return w;
}
int nextIndex(int index, int sz) {
  if (index < (sz - 1))
    index++;
  else
    return 0;
  return index;
}
int prevIndex(int index, int sz) {
  if (index == 0)
    return (sz - 1);
  else
    index--;
  return index;
}
void process(int index, vector<int> vec, int initPos, long long tmpSumm) {
  int sz = (int)vec.size();
  for (int i = 0, j = sz - 1, k = 0; k < sz;
       i = nextIndex(i, sz), j = nextIndex(j, sz), k++) {
    int lower = vec[i];
    int upper = vec[j];
    int width = getWidth(lower, upper);
    int d = abs(getDistance(initPos, lower));
    if ((index + 1) < (int)xx.size() && (int)xx[index + 1].size() > 1) {
      seq.push_back(make_pair(i, 0));
      process(index + 1, xx[index + 1], upper, tmpSumm + width + d);
      seq.pop_back();
      d = abs(getDistance(initPos, upper));
      seq.push_back(make_pair(j, 1));
      process(index + 1, xx[index + 1], lower, tmpSumm + width + d);
      seq.pop_back();
    } else if ((index + 1) < (int)xx.size() && (int)xx[index + 1].size() == 1) {
      int last = xx[index + 1][0];
      int dLast = abs(getDistance(upper, last));
      int dLast1 = abs(getDistance(lower, last));
      int d1 = abs(getDistance(initPos, upper));
      if ((tmpSumm + width + min(d + dLast, d1 + dLast1)) < tmpSum) {
        tmpSum = tmpSumm + width + min(d + dLast, d1 + dLast1);
        if ((d + dLast) < (d1 + dLast1))
          seq.push_back(make_pair(i, 0));
        else
          seq.push_back(make_pair(j, 1));
        seqVector.clear();
        seqVector.push_back(seq);
        seq.pop_back();
      }
    } else {
      int d1 = abs(getDistance(initPos, upper));
      if ((tmpSumm + width + min(d, d1)) < tmpSum) {
        tmpSum = tmpSumm + width + min(d, d1);
        if (d < d1)
          seq.push_back(make_pair(i, 0));
        else
          seq.push_back(make_pair(j, 1));
        seqVector.clear();
        seqVector.push_back(seq);
        seq.pop_back();
      }
    }
  }
}
int main() {
  vector<int> x;
  int value, i = 0;
  cin >> length >> initPos;
  while (i < length) {
    cin >> value;
    x.push_back(value);
    i++;
  }
  vector<int> y(x.size());
  size_t n(0);
  generate(begin(y), end(y), [&] { return n++; });
  sort(begin(y), end(y), [&](int i1, int i2) { return x[i1] < x[i2]; });
  initPos--;
  vector<int> tmp;
  for (i = 0; i < length; i++) {
    if ((i < (length - 1)) && (x[y[i + 1]] == x[y[i]])) {
      while ((i < (length - 1)) && (x[y[i + 1]] == x[y[i]])) {
        tmp.push_back(y[i]);
        i++;
      }
      tmp.push_back(y[i]);
      sort(tmp.begin(), tmp.end());
      xx.push_back(tmp);
      tmp.clear();
    } else {
      tmp.push_back(y[i]);
      xx.push_back(tmp);
      tmp.clear();
    }
  }
  int step, nn;
  for (i = 0; i < (int)xx.size(); i++) {
    if ((int)xx[i].size() > 1) {
      long long tmpSumm = 0;
      process(i, xx[i], initPos, tmpSumm);
      tmpSum = INF;
      seq.clear();
      nn = seqVector[0].size();
      for (int j = 0; j < nn; j++) {
        int bIndex = seqVector[0][j].first;
        int clockwise = seqVector[0][j].second;
        int sz = (int)xx[i + j].size();
        if (clockwise == 0) {
          for (int k = bIndex, kk = 0; kk < sz; k = nextIndex(k, sz), kk++) {
            step = getDistance(initPos, xx[i + j][k]);
            sum += abs(step);
            dp.push_back(step);
            initPos = xx[i + j][k];
          }
        } else {
          for (int k = bIndex, kk = 0; kk < sz; k = prevIndex(k, sz), kk++) {
            step = getDistance(initPos, xx[i + j][k]);
            sum += abs(step);
            dp.push_back(step);
            initPos = xx[i + j][k];
          }
        }
      }
      i = i + nn - 1;
    } else {
      step = getDistance(initPos, xx[i][0]);
      sum += abs(step);
      dp.push_back(step);
      initPos = xx[i][0];
    }
  }
  cout << sum << endl;
  for (i = 0; i < length; i++) {
    if (dp[i] >= 0) cout << "+";
    cout << dp[i] << endl;
  }
  return 0;
}