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;
using ld = long double;
template <typename T>
inline void read(T &x) {
  char c;
  bool nega = 0;
  while ((!isdigit(c = getchar())) && (c != '-'))
    ;
  if (c == '-') {
    nega = 1;
    c = getchar();
  }
  x = c - 48;
  while (isdigit(c = getchar())) x = x * 10 + c - 48;
  if (nega) x = -x;
}
template <typename T>
inline void writep(T x) {
  if (x > 9) writep(x / 10);
  putchar(x % 10 + 48);
}
template <typename T>
inline void write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  writep(x);
}
template <typename T>
inline void writeln(T x) {
  write(x);
  putchar('\n');
}
int n, s;
int a[2000];
deque<int> pos[2001];
map<int, int> m;
int f[2001];
int trace[2001];
int g[2001];
int dist_inc(int u, int v) {
  if (v >= u) return v - u;
  return v + n - u;
}
int dist_dec(int u, int v) {
  if (v <= u) return u - v;
  return u + n - v;
}
int dist(int u, int v) { return min(abs(u - v), n - abs(u - v)); }
void output(int x) {
  putchar("+-"[x < 0]);
  writeln(abs(x));
}
void rebuild(int u) {
  if (a[u] > 1) rebuild(trace[u]);
  if ((a[u] == 1) && (a[s] == 1)) {
    output(0);
    return;
  }
  int x = a[u];
  int sz = pos[x].size();
  int i = trace[u];
  if (pos[x].size() == 1) {
    if (dist(i, u) == dist_inc(i, u)) {
      output(dist(i, u));
    } else {
      output(-dist(trace[u], u));
    }
  } else {
    while (dist_inc(pos[x].back(), i) + dist_inc(i, pos[x].front()) !=
           dist_inc(pos[x].back(), pos[x].front())) {
      pos[x].push_back(pos[x].front());
      pos[x].pop_front();
    }
    if (i == s) {
      if (a[s] == 0)
        g[s] = 0;
      else
        g[s] = f[s];
    }
    int maxs = dist_inc(i, pos[x].front());
    int tmax = pos[x].front();
    for (int j = (0); j < (sz); j++) {
      if (j) {
        if (maxs < dist_inc(pos[x][j - 1], pos[x][j])) {
          maxs = dist_inc(pos[x][j - 1], pos[x][j]);
          tmax = pos[x][j];
        }
      }
      if (pos[x][j] == u) break;
    }
    if (f[u] == g[i] + n + dist_inc(i, u) - maxs * 2) {
      int last = i;
      for (int j = (0); j < (sz); j++) {
        if (pos[x][j] == tmax) break;
        last = pos[x][j];
        output(dist_inc((j == 0) ? i : pos[x][j - 1], pos[x][j]));
      }
      for (int j = (sz - 1); j >= (0); j--) {
        output(-dist_dec((j == sz - 1) ? last : pos[x][j + 1], pos[x][j]));
        if (pos[x][j] == tmax) {
          if (tmax == u) break;
          output(dist_inc(tmax, u));
          break;
        }
      }
      return;
    }
    maxs = dist_dec(i, pos[x].back());
    tmax = pos[x].back();
    for (int j = (sz - 1); j >= (0); j--) {
      if (j < sz - 1) {
        if (maxs < dist_dec(pos[x][j + 1], pos[x][j])) {
          maxs = dist_dec(pos[x][j + 1], pos[x][j]);
          tmax = pos[x][j];
        }
      }
      if (pos[x][j] == u) break;
    }
    if (f[u] == g[i] + n + dist_dec(i, u) - maxs * 2) {
      int last = i;
      for (int j = (sz - 1); j >= (0); j--) {
        if (pos[x][j] == tmax) break;
        last = pos[x][j];
        output(-dist_dec((j == sz - 1) ? i : pos[x][j + 1], pos[x][j]));
      }
      for (int j = (0); j < (sz); j++) {
        output(dist_inc((j == 0) ? last : pos[x][j - 1], pos[x][j]));
        if (pos[x][j] == tmax) {
          if (tmax == u) break;
          output(-dist_dec(tmax, u));
          break;
        }
      }
      return;
    }
  }
}
int main() {
  read(n);
  read(s);
  s--;
  for (int i = (0); i < (n); i++) read(a[i]);
  if (a[s] == *min_element(a, a + n)) {
    a[s]--;
  }
  for (int i = (0); i < (n); i++) m[a[i]] = 0;
  {
    int cnt = 0;
    for (auto &t : m) t.second = ++cnt;
  }
  for (int i = (0); i < (n); i++) {
    a[i] = m[a[i]];
    pos[a[i]].push_back(i);
  }
  if (a[s] != 1) pos[0].push_back(s);
  for (int x = (1 + (a[s] == 1)); x <= (m.size()); x++) {
    for (int i : pos[x - 1]) g[i] = f[i];
    for (int i : pos[x]) f[i] = 1e9;
    int sz = pos[x].size();
    for (int i : pos[x - 1]) {
      if (pos[x].size() == 1) {
        if (f[pos[x][0]] > g[i] + dist(i, pos[x][0])) {
          f[pos[x][0]] = g[i] + dist(i, pos[x][0]);
          trace[pos[x][0]] = i;
        }
      } else {
        while (dist_inc(pos[x].back(), i) + dist_inc(i, pos[x].front()) !=
               dist_inc(pos[x].back(), pos[x].front())) {
          pos[x].push_back(pos[x].front());
          pos[x].pop_front();
        }
        int maxs = dist_inc(i, pos[x].front());
        for (int j = (0); j < (sz); j++) {
          if (j) maxs = max(maxs, dist_inc(pos[x][j - 1], pos[x][j]));
          if (f[pos[x][j]] > g[i] + n + dist_inc(i, pos[x][j]) - maxs * 2) {
            f[pos[x][j]] = g[i] + n + dist_inc(i, pos[x][j]) - maxs * 2;
            trace[pos[x][j]] = i;
          }
        }
        maxs = dist_dec(i, pos[x].back());
        for (int j = (sz - 1); j >= (0); j--) {
          if (j + 1 < sz) maxs = max(maxs, dist_dec(pos[x][j + 1], pos[x][j]));
          if (f[pos[x][j]] > g[i] + n + dist_dec(i, pos[x][j]) - maxs * 2) {
            f[pos[x][j]] = g[i] + n + dist_dec(i, pos[x][j]) - maxs * 2;
            trace[pos[x][j]] = i;
          }
        }
      }
    }
  }
  int best = pos[m.size()][0];
  for (int i : pos[m.size()])
    if (f[i] < f[best]) best = i;
  writeln(f[best]);
  rebuild(best);
}