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;
inline int dist(int a, int b, int n, bool clockwise) {
  if (clockwise) {
    if (a <= b)
      return b - a;
    else
      return n + b - a;
  } else {
    if (a < b)
      return n + a - b;
    else
      return a - b;
  }
}
inline int short_dist(int a, int b, int n) {
  int c_dist;
  c_dist = dist(a, b, n, true);
  if (n < (c_dist << 1))
    return c_dist - n;
  else
    return c_dist;
}
inline list<int>::iterator pred(list<int>::iterator x, list<int> *l) {
  if (x == l->begin()) x = l->end();
  x--;
  return x;
}
inline list<int>::iterator succ(list<int>::iterator x, list<int> *l) {
  x++;
  if (x == l->end()) x = l->begin();
  return x;
}
inline void print(int x) {
  if (x >= 0) cout << "+";
  cout << x << endl;
}
int main() {
  int n, s;
  int i, j;
  int sd, sd2;
  int res_time, res_prev, res_next;
  bool res_clock;
  long int cur;
  list<int> *equals, *last;
  list<int>::iterator next, prev;
  list<list<int> *> layers;
  list<list<int> *>::reverse_iterator next_layer;
  bool start_s;
  list<int> move;
  cin >> n >> s;
  s--;
  pair<long int, int> *a = new pair<long int, int>[n];
  vector<int> v_time(n), v_prev(n), v_next(n);
  vector<bool> v_clock(n);
  for (i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a, a + n);
  i = 0;
  last = new list<int>;
  last->clear();
  last->push_back(s);
  v_time[s] = 0;
  start_s = false;
  while (i < n) {
    cur = a[i].first;
    equals = new list<int>;
    equals->clear();
    equals->push_back(a[i].second);
    j = i + 1;
    while ((j < n) && (a[j].first == cur)) {
      equals->push_back(a[j].second);
      j++;
    }
    for (next = equals->begin(); next != equals->end(); ++next) {
      res_time = 3 * 2000 * 2000;
      res_prev = -1;
      res_next = -1;
      for (prev = last->begin(); prev != last->end(); ++prev) {
        if (equals->size() == 1) {
          sd = short_dist(*prev, *next, n);
          if (v_time[*prev] + abs(sd) < res_time) {
            res_time = v_time[*prev] + abs(sd);
            res_prev = *prev;
            res_next = *next;
            res_clock = (sd >= 0);
          }
        } else {
          if (*prev == *next)
            start_s = true;
          else {
            sd = short_dist(*prev, *succ(next, equals), n);
            sd2 = dist(*succ(next, equals), *next, n, true);
            if (v_time[*prev] + abs(sd) + sd2 < res_time) {
              res_time = v_time[*prev] + abs(sd) + sd2;
              res_prev = *prev;
              res_next = *succ(next, equals);
              res_clock = true;
            }
            sd = short_dist(*prev, *pred(next, equals), n);
            sd2 = dist(*pred(next, equals), *next, n, false);
            if (v_time[*prev] + abs(sd) + sd2 < res_time) {
              res_time = v_time[*prev] + abs(sd) + sd2;
              res_prev = *prev;
              res_next = *pred(next, equals);
              res_clock = false;
            }
          }
        }
      }
      if (res_prev >= 0) {
        v_time[*next] = res_time;
        v_prev[*next] = res_prev;
        v_next[*next] = res_next;
        v_clock[*next] = res_clock;
      }
    }
    layers.push_back(equals);
    last = equals;
    if (start_s) {
      v_time[s] = 3 * 2000 * 2000;
      v_prev[s] = -1;
      v_next[s] = -1;
      start_s = false;
    }
    i = j;
  }
  res_time = 3 * 2000 * 2000;
  i = -1;
  for (next = last->begin(); next != last->end(); ++next) {
    if (v_time[*next] < res_time) {
      res_time = v_time[*next];
      i = *next;
    }
  }
  cout << res_time << endl;
  for (next_layer = layers.rbegin(); next_layer != layers.rend();
       ++next_layer) {
    equals = *next_layer;
    if (equals->size() == 1) {
      move.push_front(short_dist(v_prev[i], i, n));
    } else {
      next = equals->begin();
      while (*next != i) next++;
      if (v_clock[i]) {
        while (*pred(next, equals) != i) {
          move.push_front(dist(*pred(next, equals), *next, n, true));
          next = pred(next, equals);
        }
      } else {
        while (*succ(next, equals) != i) {
          move.push_front(-dist(*succ(next, equals), *next, n, false));
          next = succ(next, equals);
        }
      }
      move.push_front(short_dist(v_prev[i], v_next[i], n));
    }
    i = v_prev[i];
  }
  for (next = move.begin(); next != move.end(); ++next) print(*next);
}