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;
const int N = 2000;
int mem[N + 1][2][2];
struct state {
  int i;
  bool start, left;
};
state succ[N + 1][2][2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, s;
  cin >> n >> s;
  vector<int> a(2 * n);
  int max_ai = 0;
  int min_ai = numeric_limits<int>::max();
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[n + i] = a[i];
    max_ai = max(max_ai, a[i]);
    min_ai = min(min_ai, a[i]);
  }
  set<int> a_set(a.begin(), a.end());
  vector<int> a_unique(a_set.begin(), a_set.end());
  map<int, int> gt;
  for (int i = 1; i < a_unique.size(); i++) {
    gt[a_unique[i - 1]] = a_unique[i];
  }
  gt[max_ai] = -1;
  map<int, int> last_occ;
  vector<int> left_eq(2 * n);
  for (int i = 0; i < 2 * n; i++) {
    left_eq[i] = last_occ.count(a[i]) ? last_occ[a[i]] : 0;
    last_occ[a[i]] = i;
  }
  last_occ.clear();
  vector<int> right_eq(2 * n);
  for (int i = 2 * n - 1; i >= 0; i--) {
    right_eq[i] = last_occ.count(a[i]) ? last_occ[a[i]] : 0;
    last_occ[a[i]] = i;
  }
  auto d_left = [&](int from, int to) { return (from - to + n) % n; };
  auto d_right = [&](int from, int to) { return (to - from + n) % n; };
  function<int(int, bool, bool)> opt = [&](int i, bool start, bool first) {
    int& ans = mem[i][start][first];
    state& nex = succ[i][start][first];
    if (ans == -1) {
      if (start) {
        int left = (n - d_right(i, right_eq[i] % n)) % n +
                   opt(right_eq[i] % n, false, false);
        int right = (n - d_left(i, left_eq[n + i] % n)) % n +
                    opt(left_eq[n + i] % n, false, false);
        ans = min(left, right);
        nex = ans == left ? state{right_eq[i] % n, false, 1}
                          : state{left_eq[n + i] % n, false, 0};
      } else if (first or a[i] < max_ai) {
        ans = numeric_limits<int>::max();
        for (int j = 0; j < n; j++) {
          if (a[j] == (first ? min_ai : gt[a[i]])) {
            int cur = min(d_left(i, j), d_right(i, j)) + opt(j, true, false);
            if (ans > cur) {
              ans = cur;
              nex = {j, true, d_left(i, j) < d_right(i, j)};
            }
          }
        }
      } else {
        ans = 0;
      }
    }
    return ans;
  };
  memset(mem, -1, sizeof mem);
  cout << opt(s - 1, false, true) << endl;
  int i = s - 1, start = false, first = true;
  while (first or start or a[i] != max_ai) {
    auto [nex_i, nex_start, left] = succ[i][start][first];
    if (start) {
      while (i != nex_i) {
        cout << (left ? "-" : "+")
             << (left ? d_left(i, left_eq[n + i] % n) : d_right(i, right_eq[i]))
             << endl;
        i = (left ? left_eq[n + i] : right_eq[i]) % n;
      }
    } else {
      cout << (left ? "-" : "+")
           << (left ? d_left(i, nex_i) : d_right(i, nex_i)) << endl;
    }
    i = nex_i, start = nex_start, first = false;
  }
  return 0;
}