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>
#pragma GCC optimize("O3")
using namespace std;
const int N = 2e3 + 5;
int n, s, a[N], memo[N][2];
int pos[N], nxt[N][2];
pair<int, int> lst[N][2];
vector<int> g[N];
void get(int dir, int cost) {
  dir ? cout << '+' : cout << '-';
  cout << cost << '\n';
}
int calc(int i, int j, int dir) {
  if (dir) {
    if (j >= i) return j - i;
    return n - i + j;
  }
  if (i >= j) return i - j;
  return i + n - j;
}
int solve(int i, int dir) {
  if (i == n) return 0;
  int &ans = memo[i][dir];
  if (~ans) return ans;
  ans = 1e9;
  int cur = lst[i][dir].second;
  for (int j = 0; j <= 1; j++) {
    for (int k = 0; k <= 1; k++) {
      int c = lst[i][dir].first;
      if (nxt[cur][k] != n) c += calc(cur, nxt[cur][k], k);
      ans = min(ans, solve(nxt[cur][k], j) + c);
    }
  }
  return ans;
}
void build(int i, int dir) {
  if (i == n) exit(0);
  int ans = 1e9;
  int cur = lst[i][dir].second;
  int f = (dir ? 1 : -1), j = pos[i];
  vector<int> &v = g[a[i]];
  while (1) {
    int k = (j + f + v.size()) % v.size();
    if (k == pos[i]) break;
    get(dir, calc(v[j], v[k], dir));
    j = k;
  }
  for (int j = 0; j <= 1; j++) {
    for (int k = 0; k <= 1; k++) {
      int c = lst[i][dir].first;
      if (nxt[cur][k] != n) c += calc(cur, nxt[cur][k], k);
      ans = min(ans, solve(nxt[cur][k], j) + c);
    }
  }
  for (int j = 0; j <= 1; j++) {
    for (int k = 0; k <= 1; k++) {
      int c = lst[i][dir].first;
      if (nxt[cur][k] != n) c += calc(cur, nxt[cur][k], k);
      if (solve(nxt[cur][k], j) + c == ans) {
        if (nxt[cur][k] != n) get(k, calc(cur, nxt[cur][k], k));
        build(nxt[cur][k], j);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s, s--;
  map<int, int> mp;
  for (int i = 0; i < n; i++) cin >> a[i], mp[a[i]] = 0;
  int id = 0;
  for (auto &i : mp) i.second = id++;
  for (int i = 0; i < n; i++) {
    a[i] = mp[a[i]];
    pos[i] = g[a[i]].size();
    g[a[i]].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    vector<int> &v = g[a[i]];
    if (pos[i] + 1 == v.size())
      lst[i][0] = {i - v[0], v[0]};
    else
      lst[i][0] = {i + n - v[pos[i] + 1], v[pos[i] + 1]};
    if (pos[i])
      lst[i][1] = {n - i + v[pos[i] - 1], v[pos[i] - 1]};
    else
      lst[i][1] = {v.back() - i, v.back()};
  }
  for (int i = 0; i < n; i++) {
    vector<int> &v = g[a[i] + 1];
    if (v.empty()) {
      nxt[i][0] = nxt[i][1] = n;
      continue;
    }
    int k = lower_bound(v.begin(), v.end(), i) - v.begin();
    if (k)
      nxt[i][0] = v[k - 1];
    else
      nxt[i][0] = v.back();
    if (k == v.size())
      nxt[i][1] = v[0];
    else
      nxt[i][1] = v[k];
  }
  memset(memo, -1, sizeof memo);
  int ans = 1e9;
  for (int i = 0; i < n; i++)
    if (!a[i])
      for (int j = 0; j <= 1; j++)
        for (int k = 0; k <= 1; k++)
          ans = min(ans, solve(i, j) + calc(s, i, k));
  cout << ans << '\n';
  for (int i = 0; i < n; i++)
    if (!a[i])
      for (int j = 0; j <= 1; j++)
        for (int k = 0; k <= 1; k++)
          if (solve(i, j) + calc(s, i, k) == ans)
            get(k, calc(s, i, k)), build(i, j);
  return 0;
}