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;
static auto _ = []() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  return 0;
}();
constexpr int INF_INT = int(2e9);
int n, s;
vector<int> a, z1, z2, dp;
unordered_map<int, vector<int> > positions;
inline int min_dist(int x, int y) {
  int d = abs(x - y);
  return min(d, n - d);
}
inline int clockwise_dist(int x, int y) { return (y - x + n) % n; }
int solve2(int);
int solve1(int v) {
  int& ans = z1[v];
  if (ans != -1) return ans;
  ans = INF_INT;
  for (int direction = -1; direction <= +1; direction += 2) {
    int idx = -1;
    for (int i = 1; i < n; ++i) {
      int temp_idx = (v + i * direction + n) % n;
      if (a[temp_idx] == a[v]) {
        idx = temp_idx;
        break;
      }
    }
    if (idx == -1) {
      ans = min(ans, solve2(v));
    } else {
      int dist =
          direction > 0 ? clockwise_dist(idx, v) : clockwise_dist(v, idx);
      ans = min(ans, solve2(idx) + dist);
    }
  }
  return ans;
}
int solve2(int v) {
  int& ans = z2[v];
  if (ans != -1) return ans;
  if (dp[v] == INF_INT) return ans = 0;
  ans = INF_INT;
  for (int i : positions[dp[v]]) ans = min(ans, solve1(i) + min_dist(v, i));
  return ans;
}
void restore2(int);
void restore1(int v) {
  int& ans = z1[v];
  for (int direction = -1; direction <= +1; direction += 2) {
    int idx = -1;
    for (int i = 1; i < n; ++i) {
      int temp_idx = (v + i * direction + n) % n;
      if (a[temp_idx] == a[v]) {
        idx = temp_idx;
        break;
      }
    }
    if (idx == -1) {
      if (ans == solve2(v)) return restore2(v);
    } else {
      int dist =
          direction == 1 ? clockwise_dist(idx, v) : clockwise_dist(v, idx);
      if (ans == solve2(idx) + dist) {
        int dst = 0;
        for (int i = 1; i < n; ++i) {
          int temp_idx = (v + i * (-direction) + n) % n;
          dst++;
          if (a[temp_idx] == a[v]) {
            if (direction > 0)
              cout << '-';
            else
              cout << '+';
            cout << dst << '\n';
            dst = 0;
          }
        }
        return restore2(idx);
      }
    }
  }
}
void restore2(int v) {
  int& ans = z2[v];
  if (dp[v] == INF_INT) return;
  for (int i : positions[dp[v]]) {
    if (ans == solve1(i) + min_dist(v, i)) {
      int d = (i - v + n) % n;
      if (d <= n - d)
        cout << '+' << d << '\n';
      else
        cout << '-' << n - d << '\n';
      return restore1(i);
      ;
    }
  }
}
int main() {
  cin >> n >> s;
  s--;
  a.resize(n);
  z1.resize(n, -1);
  z2.resize(n, -1);
  dp.resize(n, INF_INT);
  for (int i = 0; i < n; ++i) {
    int item;
    cin >> item;
    a[i] = item;
    positions[item].push_back(i);
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      if (a[j] > a[i]) dp[i] = min(dp[i], a[j]);
  int min_a = *min_element((a).begin(), (a).end());
  int ans = INF_INT;
  for (int i : positions[min_a]) ans = min(ans, solve1(i) + min_dist(s, i));
  cout << ans << '\n';
  for (int i : positions[min_a]) {
    if (ans == solve1(i) + min_dist(s, i)) {
      int d = (i - s + n) % n;
      if (d <= n - d)
        cout << '+' << d << '\n';
      else
        cout << '-' << n - d << '\n';
      restore1(i);
      break;
    }
  }
  return 0;
}