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>
int n, s;
std::vector<int> a;
std::vector<bool> printed;
std::map<int, std::vector<int> > levels;
struct Edge {
  int len;
  int dir;
  int back;
};
std::vector<std::vector<Edge> > d, d2;
inline int lencw(int i, int j) { return (i <= j) ? j - i : n - i + j; }
inline int lenccw(int i, int j) { return (i < j) ? i + n - j : i - j; }
int go(int pos, int count, int delta, int need) {
  int len = 0;
  for (int i = 0; i < count; i++) {
    pos += delta;
    len++;
    if (pos < 0)
      pos = n - 1;
    else if (pos == n)
      pos = 0;
    if (!printed[pos] && a[pos] == need) {
      if (delta > 0)
        putchar('+');
      else
        putchar('-');
      printf("%d\n", len);
      len = 0;
      printed[pos] = true;
    }
  }
  return pos;
}
void go(int from, int to) {
  Edge &e = d[from][to];
  int v = go(from, e.back, -e.dir, a[to]);
  go(v, e.len - e.back, e.dir, a[to]);
}
int main() {
  scanf("%d %d", &n, &s);
  s--;
  a.resize(n);
  printed.resize(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    levels[a[i]].push_back(i);
  }
  d.resize(n, std::vector<Edge>(n));
  d2.resize(n, std::vector<Edge>(n));
  std::vector<int> f(n, 2000000000);
  std::vector<int> prev(n);
  for (auto level : levels) {
    for (int to : level.second) {
      int from = to;
      bool meet = false;
      int back = 0;
      for (;;) {
        from = (from + 1) % n;
        if (meet) back++;
        if (from == to) {
          if (meet) {
            if (back * 2 < n)
              d[from][to] = {2 * back, 1, back};
            else
              d[from][to] = {n, 1, 0};
          } else {
            d[from][to] = {0, 1, 0};
          }
          break;
        }
        d[from][to] = {lencw(from, to) + 2 * back, 1, back};
        if (a[from] == a[to]) {
          meet = true;
        }
      }
      from = to;
      meet = false;
      back = 0;
      for (;;) {
        from--;
        if (from < 0) from = n - 1;
        if (meet) back++;
        if (from == to) {
          if (meet) {
            if (back * 2 < n)
              d2[from][to] = {2 * back, -1, back};
            else
              d2[from][to] = {n, -1, 0};
          } else {
            d2[from][to] = {0, -1, 0};
          }
          break;
        }
        d2[from][to] = {lenccw(from, to) + 2 * back, -1, back};
        if (a[from] == a[to]) {
          meet = true;
        }
      }
      for (int from = 0; from < n; from++)
        if (d2[from][to].len < d[from][to].len) d[from][to] = d2[from][to];
    }
  }
  for (int to : levels.begin()->second) {
    f[to] = d[s][to].len;
    prev[to] = s;
  }
  for (auto it = levels.begin();; it++) {
    auto it2 = it;
    it2++;
    if (it2 == levels.end()) break;
    for (int to : it2->second) {
      for (int from : it->second) {
        if (f[from] + d[from][to].len < f[to]) {
          f[to] = f[from] + d[from][to].len;
          prev[to] = from;
        }
      }
    }
  }
  auto it = levels.end();
  it--;
  std::vector<int> &pos = it->second;
  int last = -1;
  for (int to : it->second) {
    if (last < 0 || f[to] < f[last]) {
      last = to;
    }
  }
  printf("%d\n", f[last]);
  if (a[s] == levels.begin()->first) {
    printf("+0\n");
    printed[s] = true;
  }
  std::stack<int> route;
  for (;;) {
    route.push(last);
    if (prev[last] == s && a[last] == levels.begin()->first) {
      route.push(prev[last]);
      break;
    }
    last = prev[last];
  }
  int from = route.top();
  route.pop();
  while (!route.empty()) {
    go(from, route.top());
    from = route.top();
    route.pop();
  }
}