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 <typename T>
using V = vector<T>;
int gcdex(int a, int b, int &x, int &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  int x1, y1;
  int g = gcdex(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return g;
}
inline int ADD_MOD(int a, int b) { return (a + b) % 1000000007; }
inline int MUL_MOD(int a, int b) { return (int64_t(a) * b) % 1000000007; }
inline int SUB_MOD(int a, int b) { return a >= b ? a - b : a + 1000000007 - b; }
int DIV_MOD(int a, int b) {
  int x, y;
  gcdex(b, 1000000007, x, y);
  int b1 = (x % 1000000007 + 1000000007) % 1000000007;
  return MUL_MOD(a, b1);
}
const long double EPS = 1. / 1e9;
inline bool EPS_EQUAL(long double a, long double b) {
  return abs(a - b) <= EPS;
}
inline bool EPS_LESS(long double a, long double b) { return b - a > EPS; }
inline bool EPS_GREATER(long double a, long double b) { return a - b > EPS; }
const int INF = 1e9;
const int64_t INF64 = 2e18;
struct Dp {
  int first;
  int parentFirst;
  int last;
  int parentLast;
};
int cw(int n, int a, int b) {
  if (b >= a) return b - a;
  return b - a + n;
}
int ccw(int n, int a, int b) {
  if (a >= b) return a - b;
  return a - b + n;
}
int dist(int n, int a, int b) { return min(cw(n, a, b), ccw(n, a, b)); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(15);
  int n, s;
  cin >> n >> s;
  --s;
  V<pair<int, int>> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  V<V<int>> groups;
  groups.push_back({});
  groups.back().push_back(a[0].second);
  int cur = a[0].first;
  for (int i = 1; i < n; ++i) {
    if (a[i].first != cur) {
      groups.push_back({});
      cur = a[i].first;
    }
    groups.back().push_back(a[i].second);
  }
  V<Dp> dp(n);
  for (int i = 0; i < groups.size(); ++i) {
    auto &g = groups[i];
    int gSize = g.size();
    if (i > 0) {
      for (auto &j : g) {
        int minD = INF;
        int minPrev = -1;
        for (auto &prev : groups[i - 1]) {
          int d = dist(n, j, prev) + dp[prev].last;
          if (d < minD) {
            minD = d;
            minPrev = prev;
          }
        }
        dp[j].first = minD;
        dp[j].parentFirst = minPrev;
      }
    } else {
      for (auto &j : g) {
        dp[j].first = dist(n, j, s);
        dp[j].parentFirst = -1;
      }
    }
    if (gSize > 1) {
      for (int j = 0; j < gSize; ++j) {
        int minD = INF;
        int minPrev = -1;
        int cur = g[j];
        int cwJ = g[(j + 1) % gSize];
        int ccwJ = g[j > 0 ? j - 1 : gSize - 1];
        for (auto &first : g) {
          if (first != cur) {
            int d = min(ccw(n, first, cwJ) + cw(n, cwJ, cur),
                        cw(n, first, ccwJ) + ccw(n, ccwJ, cur)) +
                    dp[first].first;
            if (d < minD) {
              minD = d;
              minPrev = first;
            }
          }
        }
        dp[cur].last = minD;
        dp[cur].parentLast = minPrev;
      }
    } else {
      dp[g[0]].last = dp[g[0]].first;
      dp[g[0]].parentLast = g[0];
    }
  }
  int minRes = INF;
  int last = -1;
  for (auto &i : groups.back()) {
    if (dp[i].last < minRes) {
      minRes = dp[i].last;
      last = i;
    }
  }
  cout << minRes << endl;
  V<int> path;
  for (int i = groups.size() - 1; i >= 0; --i) {
    auto &g = groups[i];
    int gSize = g.size();
    int first = dp[last].parentLast;
    if (first != last) {
      int iLast = lower_bound(g.begin(), g.end(), last) - g.begin();
      int cwLast = g[(iLast + 1) % gSize];
      int ccwLast = g[iLast > 0 ? iLast - 1 : gSize - 1];
      int cwD = ccw(n, first, cwLast) + cw(n, cwLast, last);
      int ccwD = cw(n, first, ccwLast) + ccw(n, ccwLast, last);
      if (cwD < ccwD) {
        int prev = last;
        for (int j = 1; j < gSize; ++j) {
          int cur = iLast - j;
          if (cur < 0) cur += gSize;
          if (g[cur] != first || j == gSize - 1) {
            path.push_back(ccw(n, prev, g[cur]));
            prev = g[cur];
          }
        }
        if (prev != first) {
          path.push_back(-cw(n, prev, first));
        }
      } else {
        int prev = last;
        for (int j = 1; j < gSize; ++j) {
          int cur = (iLast + j) % gSize;
          if (g[cur] != first || j == gSize - 1) {
            path.push_back(-cw(n, prev, g[cur]));
            prev = g[cur];
          }
        }
        if (prev != first) {
          path.push_back(ccw(n, prev, first));
        }
      }
    }
    last = dp[first].parentFirst;
    int lastPos = last < 0 ? s : last;
    int cwD = cw(n, first, lastPos);
    int ccwD = ccw(n, first, lastPos);
    if (cwD < ccwD) {
      path.push_back(-cwD);
    } else {
      path.push_back(ccwD);
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    cout << (path[i] >= 0 ? "+" : "") << path[i] << endl;
  }
  return 0;
}