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;
int n, s;
int dp[2010], com[2010], cnt;
vector<int> las[2010], now;
pair<int, int> a[2010];
int len(int x, int y) {
  if (x > y) swap(x, y);
  return min(y - x, x + n - y);
}
int len(int x, int y, int blo) {
  if (x > y) swap(x, y);
  if (blo == x || blo == y) return len(x, y);
  if (x < blo && blo < y) return x + n - y;
  if (blo < x || blo > y) return y - x;
}
bool checkin(int x, int l, int r) {
  if (l < r)
    return x >= l && x <= r;
  else
    return x <= r || x >= l;
}
void solve() {
  int m = now.size();
  for (int i = 0; i < m; i++)
    for (int j = 0; j < las[cnt].size(); j++) {
      int prep = now[(i - 1 + m) % m];
      int lasp = now[(i + 1 + m) % m];
      int u = now[i];
      int v = las[cnt][j];
      int val = 0;
      if (prep == lasp) {
        val = len(v, prep) + len(prep, u);
      } else if (checkin(v, prep, lasp)) {
        val = n - len(u, v, prep);
      } else
        val =
            len(v, prep, u) + len(v, lasp, u) +
            min(len(v, lasp, u) + len(prep, u), len(v, prep, u) + len(lasp, u));
      if (cnt != 0) val += dp[las[cnt][j]];
      if (val < dp[now[i]]) {
        dp[now[i]] = val;
        com[now[i]] = j;
      }
    }
  cnt++;
  for (int i = 0; i < m; i++) las[cnt].push_back(now[i]);
  now.clear();
}
vector<int> print;
int len1(int x, int y) {
  int lenx = len(x, y);
  if ((x + lenx - 1) % n + 1 == y)
    return lenx;
  else
    return -lenx;
}
void get_ans(int x, int tim) {
  if (tim != 1) get_ans(com[las[tim][x]], tim - 1);
  int m = las[tim].size();
  int prep = las[tim][(x - 1 + m) % m];
  int lasp = las[tim][(x + 1) % m];
  int u = las[tim][x];
  int v = las[tim - 1][com[u]];
  int val = 0;
  if (prep == lasp) {
    print.push_back(len1(v, prep));
    if (prep != u) print.push_back(len1(prep, u));
  } else if (checkin(v, prep, lasp)) {
    if (checkin(v, prep, u)) {
      print.push_back(len1(v, prep));
      for (int j = (x - 1 + m) % m; j != x; j = (j - 1 + m) % m)
        print.push_back(len1(las[tim][j], las[tim][(j - 1 + m) % m]));
    } else {
      print.push_back(len1(v, lasp));
      for (int j = (x + 1) % m; j != x; j = (j + 1) % m)
        print.push_back(len1(las[tim][j], las[tim][(j + 1) % m]));
    }
  } else {
    if (len(v, lasp, u) + len(prep, u) < len(v, prep, u) + len(lasp, u)) {
      print.push_back(len1(v, lasp));
      for (int j = (x + 1) % m; j != x; j = (j + 1) % m)
        print.push_back(len1(las[tim][j], las[tim][(j + 1) % m]));
    } else {
      print.push_back(len1(v, prep));
      for (int j = (x - 1 + m) % m; j != x; j = (j - 1 + m) % m)
        print.push_back(len1(las[tim][j], las[tim][(j - 1 + m) % m]));
    }
  }
}
int main() {
  memset(dp, 0x3f3f3f3f, sizeof dp);
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].first);
    a[i].second = i;
  }
  sort(a + 1, a + 1 + n);
  las[0].push_back(s);
  now.push_back(a[1].second);
  for (int i = 2; i <= n; i++) {
    if (a[i].first != a[i - 1].first) {
      solve();
    }
    now.push_back(a[i].second);
  }
  solve();
  int minid = 0, minv = 0x3f3f3f3f;
  for (int i = 0; i < las[cnt].size(); i++)
    if (dp[las[cnt][i]] < minv) {
      minid = i;
      minv = dp[las[cnt][minid]];
    }
  printf("%d\n", minv);
  get_ans(minid, cnt);
  for (int i = 0; i < print.size(); i++) {
    if (print[i] >= 0)
      printf("+%d\n", print[i]);
    else
      printf("%d\n", print[i]);
  }
}