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 = static_cast<int>(1e9);
struct data {
  int val;
  vector<int> steps;
};
int n, s;
int cw(int from, int to) { return (to - from + n) % n; }
int ccw(int from, int to) { return (from - to + n) % n; }
int f(int x, int y) {
  int ans1 = cw(x, y);
  int ans2 = ccw(x, y);
  if (ans1 < ans2) {
    return ans1;
  } else {
    return -ans2;
  }
}
int prev(int x, int p) {
  --x;
  if (x == -1) {
    x += p;
  }
  return x;
}
int next(int x, int p) {
  ++x;
  if (x == p) {
    x = 0;
  }
  return x;
}
int visited = 0;
vector<char> used;
void out(int x) {
  ++visited;
  if (x >= 0) {
    cout << '+';
  }
  cout << x << "\n";
}
vector<int> a;
void go(int x, int val) {
  int dist = 0;
  for (int i = 0; i < abs(x); ++i) {
    if (x < 0) {
      --dist;
      s = prev(s, n);
    } else {
      ++dist;
      s = next(s, n);
    }
    if (!used[s] && val == a[s]) {
      out(dist);
      used[s] = true;
      dist = 0;
    }
  }
}
int main() {
  cin >> n >> s;
  --s;
  a.resize(n);
  vector<int> sorted;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sorted = a;
  sort((sorted).begin(), (sorted).end());
  sorted.resize(unique((sorted).begin(), (sorted).end()) - sorted.begin());
  int k = static_cast<int>((sorted).size());
  for (int i = 0; i < n; ++i) {
    a[i] = lower_bound((sorted).begin(), (sorted).end(), a[i]) - sorted.begin();
  }
  vector<vector<int> > pos(k);
  for (int i = 0; i < n; ++i) {
    pos[a[i]].push_back(i);
  }
  vector<data> dp1(n), dp2(n);
  for (int color = k - 1; color >= 0; --color) {
    if (color == k - 1) {
      for (int x : pos[color]) {
        dp2[x].val = 0;
      }
    } else {
      for (int x : pos[color]) {
        dp2[x].val = inf;
        for (int y : pos[color + 1]) {
          int d = f(x, y);
          if (dp2[x].val > dp1[y].val + abs(d)) {
            dp2[x].val = dp1[y].val + abs(d);
            dp2[x].steps = {d};
          }
        }
      }
    }
    if (static_cast<int>((pos[color]).size()) == 1) {
      int x = pos[color][0];
      dp1[x].val = dp2[x].val;
    } else {
      int p = static_cast<int>((pos[color]).size());
      for (int i = 0; i < p; ++i) {
        int x = pos[color][i];
        dp1[x].val =
            cw(x, pos[color][prev(i, p)]) + dp2[pos[color][prev(i, p)]].val;
        dp1[x].steps = {cw(x, pos[color][prev(i, p)])};
        int t =
            ccw(x, pos[color][next(i, p)]) + dp2[pos[color][next(i, p)]].val;
        if (dp1[x].val > t) {
          dp1[x].val = t;
          dp1[x].steps = {-ccw(x, pos[color][next(i, p)])};
        }
      }
    }
  }
  int ans = inf;
  int r = 0;
  for (int x : pos[0]) {
    if (ans > abs(f(s, x)) + dp1[x].val) {
      ans = abs(f(s, x)) + dp1[x].val;
      r = f(s, x);
    }
  }
  cout << ans << "\n";
  used.assign(n, false);
  out(r);
  s = (s + r + n) % n;
  used[s] = true;
  int color = 0;
  while (visited != n) {
    for (int d : dp1[s].steps) {
      go(d, color);
    }
    if (!dp2[s].steps.empty()) {
      out(dp2[s].steps[0]);
      s = (s + dp2[s].steps[0] + n) % n;
      used[s] = true;
    }
    ++color;
  }
}