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>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int Maxn = 2005;
const int Inf = 1000000000;
int n, s;
int a[Maxn];
vector<int> un;
vector<int> ind[Maxn];
int lef[Maxn], rig[Maxn];
int dp[Maxn][2][Maxn], par[Maxn][2][Maxn], wth[Maxn][2][Maxn];
vector<pair<char, int> > res;
int Rot(int a, int b) {
  if (a <= b) return b - a;
  return n + b - a;
}
int Best(int a, int b) { return min(Rot(a, b), Rot(b, a)); }
void Get(int i, int f, int k) {
  if (i < 0) return;
  if (f == 0) {
    int j = par[i][f][k];
    Get(i - 1, 1, j);
    if (Best(j, k) == Rot(j, k))
      res.push_back(pair<char, int>('+', Rot(j, k)));
    else
      res.push_back(pair<char, int>('-', Rot(k, j)));
  } else if (par[i][f][k] == k)
    Get(i, 0, k);
  else {
    int j = par[i][f][k];
    Get(i, 0, j);
    int n = ind[i].size();
    int kind = lower_bound(ind[i].begin(), ind[i].end(), k) - ind[i].begin();
    vector<int> tmp;
    if (wth[i][f][k] == -1) {
      for (int z = 1; z <= n; z++) tmp.push_back(ind[i][(kind + z) % n]);
      int jind;
      for (int z = 0; z < tmp.size(); z++)
        if (tmp[z] == j) {
          jind = z;
          break;
        }
      int lst = j;
      for (int z = jind - 1; z >= 0; z--) {
        res.push_back(pair<char, int>('-', Rot(tmp[z], lst)));
        lst = tmp[z];
      }
      for (int z = jind + 1; z < tmp.size(); z++) {
        res.push_back(pair<char, int>('+', Rot(lst, tmp[z])));
        lst = tmp[z];
      }
    } else {
      for (int z = 0; z < n; z++) tmp.push_back(ind[i][(kind + z) % n]);
      int jind;
      for (int z = 0; z < tmp.size(); z++)
        if (tmp[z] == j) {
          jind = z;
          break;
        }
      int lst = j;
      for (int z = jind + 1; z < tmp.size(); z++) {
        res.push_back(pair<char, int>('+', Rot(lst, tmp[z])));
        lst = tmp[z];
      }
      for (int z = jind - 1; z >= 0; z--) {
        res.push_back(pair<char, int>('-', Rot(tmp[z], lst)));
        lst = tmp[z];
      }
    }
  }
}
int main() {
  scanf("%d %d", &n, &s);
  s--;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    un.push_back(a[i]);
  }
  sort(un.begin(), un.end());
  un.erase(unique(un.begin(), un.end()), un.end());
  for (int i = 0; i < n; i++) {
    a[i] = lower_bound(un.begin(), un.end(), a[i]) - un.begin();
    ind[a[i]].push_back(i);
  }
  for (int i = 0; i < n; i++)
    if (ind[a[i]].size() > 1) {
      int my = lower_bound(ind[a[i]].begin(), ind[a[i]].end(), i) -
               ind[a[i]].begin();
      my = (my - 1 + ind[a[i]].size()) % ind[a[i]].size();
      lef[i] = ind[a[i]][my];
      my = (my + 2) % ind[a[i]].size();
      rig[i] = ind[a[i]][my];
    }
  fill((int*)dp, (int*)dp + Maxn * 2 * Maxn, Inf);
  for (int i = 0; i < ind[0].size(); i++) {
    dp[0][0][ind[0][i]] = Best(s, ind[0][i]);
    par[0][0][ind[0][i]] = s;
  }
  for (int i = 0; i < un.size(); i++) {
    for (int z = 0; z < ind[i].size(); z++) {
      int j = ind[i][z];
      if (ind[i].size() == 1) {
        dp[i][1][j] = dp[i][0][j];
        par[i][1][j] = j;
      } else
        for (int c = 0; c < ind[i].size(); c++) {
          int k = ind[i][c];
          if (k == j) continue;
          int cand = dp[i][0][j] + 2 * Rot(rig[k], j) + Rot(j, k);
          if (cand < dp[i][1][k]) {
            dp[i][1][k] = cand;
            par[i][1][k] = j;
            wth[i][1][k] = -1;
          }
          cand = dp[i][0][j] + 2 * Rot(j, lef[k]) + Rot(k, j);
          if (cand < dp[i][1][k]) {
            dp[i][1][k] = cand;
            par[i][1][k] = j;
            wth[i][1][k] = 1;
          }
        }
    }
    for (int z = 0; z < ind[i].size(); z++) {
      int j = ind[i][z];
      for (int c = 0; c < ind[i + 1].size(); c++) {
        int k = ind[i + 1][c];
        int cand = dp[i][1][j] + Best(j, k);
        if (cand < dp[i + 1][0][k]) {
          dp[i + 1][0][k] = cand;
          par[i + 1][0][k] = j;
        }
      }
    }
  }
  int best = Inf, bj;
  for (int j = 0; j < n; j++)
    if (dp[un.size() - 1][1][j] < best) {
      best = dp[un.size() - 1][1][j];
      bj = j;
    }
  printf("%d\n", best);
  Get(un.size() - 1, 1, bj);
  for (int i = 0; i < res.size(); i++)
    printf("%c%d\n", res[i].first, res[i].second);
  return 0;
}