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;
void testCase() {}
map<int, int> m;
int nextsame[10000];
int nextsmall[10000];
int prevsame[10000];
int prevsmall[10000];
int howmany[10000];
int dp[2001][2];
bool done[2001][2];
vector<int> lista[10000];
int prevstate[10000][2];
int prevdir[10000][2];
bool visited[10000];
int n, s;
int dist(int a, int b) { return min(min(abs(a - b), a + n - b), b + n - a); }
int distright(int a, int b) {
  if (b >= a)
    return b - a;
  else
    return n - (a - b);
}
int distleft(int a, int b) {
  if (a >= b)
    return a - b;
  else
    return n - (b - a);
}
int a[10000];
int solve(int ind, int k) {
  if (done[ind][k]) return dp[ind][k];
  if (k == 0 && a[ind] == 1) {
    dp[ind][k] = dist(ind, s);
    done[ind][k] = true;
    return dist(ind, s);
  }
  int ans = 1e9;
  if (k == 0) {
    int ind2 = nextsmall[ind];
    if (ans > distright(ind, ind2) + solve(ind2, 1)) {
      ans = distright(ind, ind2) + solve(ind2, 1);
      prevstate[ind][k] = ind2;
      prevdir[ind][k] = 1;
    }
    ind2 = prevsmall[ind];
    if (ans > distleft(ind, ind2) + solve(ind2, 1)) {
      ans = distleft(ind, ind2) + solve(ind2, 1);
      prevstate[ind][k] = ind2;
      prevdir[ind][k] = 0;
    }
  } else {
    if (howmany[a[ind]] == 1) {
      ans = solve(ind, 0);
    } else if (howmany[a[ind]] == 2) {
      int ind2 = nextsame[ind];
      ans = dist(ind, ind2) + solve(ind2, 0);
      prevstate[ind][k] = ind2;
    } else {
      for (int ind2 : lista[a[ind]]) {
        if (ind2 == ind) continue;
        int x = nextsame[ind];
        int hinta = distleft(ind, ind2) + 2 * distright(x, ind2);
        if (ans > min(ans, hinta + solve(ind2, 0))) {
          ans = min(ans, hinta + solve(ind2, 0));
          prevstate[ind][k] = ind2;
          prevdir[ind][k] = 3;
        }
        x = prevsame[ind];
        hinta = distright(ind, ind2) + 2 * distleft(x, ind2);
        if (ans > min(ans, hinta + solve(ind2, 0))) {
          ans = min(ans, hinta + solve(ind2, 0));
          prevstate[ind][k] = ind2;
          prevdir[ind][k] = 2;
        }
        x = nextsame[ind2];
        hinta = distright(ind, ind2) + 2 * distleft(ind, x);
        if (ans > min(ans, hinta + solve(ind2, 0))) {
          ans = min(ans, hinta + solve(ind2, 0));
          prevstate[ind][k] = ind2;
          prevdir[ind][k] = 1;
        }
        x = prevsame[ind2];
        hinta = distleft(ind, ind2) + 2 * distright(ind, x);
        if (ans > min(ans, hinta + solve(ind2, 0))) {
          ans = min(ans, hinta + solve(ind2, 0));
          prevstate[ind][k] = ind2;
          prevdir[ind][k] = 0;
        }
      }
    }
  }
  done[ind][k] = true;
  dp[ind][k] = ans;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  s--;
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> v;
  for (int i = 0; i < n; i++) v.push_back(a[i]);
  sort(v.begin(), v.end());
  int ind = 1;
  for (int x : v) {
    if (m[x] == 0) {
      m[x] = ind;
      ind++;
    }
  }
  for (int i = 0; i < n; i++) a[i] = m[a[i]];
  for (int i = 0; i < n; i++) howmany[a[i]]++;
  for (int i = 0; i < n; i++) {
    if (howmany[a[i]] == 1) {
      nextsame[i] = -1;
      nextsmall[i] = -1;
      for (int j = 1; j < n; j++) {
        if (a[(i + j) % n] == a[i] - 1) {
          nextsmall[i] = (i + j) % n;
          break;
        }
      }
      for (int j = 1; j < n; j++) {
        if (a[(i - j + n) % n] == a[i] - 1) {
          prevsmall[i] = (i - j + n) % n;
          break;
        }
      }
    } else if (a[i] == 1) {
      nextsmall[i] = -1;
      prevsmall[i] = -1;
      for (int j = 1; j < n; j++) {
        if (a[(i + j) % n] == a[i]) {
          nextsame[i] = (i + j) % n;
          break;
        }
      }
      for (int j = 1; j < n; j++) {
        if (a[(i - j + n) % n] == a[i]) {
          prevsame[i] = (i - j + n) % n;
          break;
        }
      }
    } else {
      for (int j = 1; j < n; j++) {
        if (a[(i + j) % n] == a[i]) {
          nextsame[i] = (i + j) % n;
          break;
        }
      }
      for (int j = 1; j < n; j++) {
        if (a[(i + j) % n] == a[i] - 1) {
          nextsmall[i] = (i + j) % n;
          break;
        }
      }
      for (int j = 1; j < n; j++) {
        if (a[(i - j + n) % n] == a[i]) {
          prevsame[i] = (i - j + n) % n;
          break;
        }
      }
      for (int j = 1; j < n; j++) {
        if (a[(i - j + n) % n] == a[i] - 1) {
          prevsmall[i] = (i - j + n) % n;
          break;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) lista[a[i]].push_back(i);
  ind--;
  int ans = 1e9;
  int index = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == ind && solve(i, 1) < ans) {
      index = i;
      ans = solve(i, 1);
    }
  }
  cout << ans << "\n";
  vector<int> stack;
  while (a[index] > 0) {
    if (howmany[a[index]] == 2) {
      int uusind = prevstate[index][1];
      if (distright(index, uusind) < distleft(index, uusind)) {
        stack.push_back(distright(index, uusind));
      } else {
        stack.push_back(-distleft(index, uusind));
      }
      index = uusind;
    } else if (howmany[a[index]] > 2) {
      int uusind = prevstate[index][1];
      if (prevdir[index][1] == 1) {
        int cur = index;
        while (prevsame[cur] != uusind) {
          stack.push_back(-distleft(cur, prevsame[cur]));
          cur = prevsame[cur];
        }
        while (nextsame[cur] != uusind) {
          stack.push_back(distright(cur, nextsame[cur]));
          cur = nextsame[cur];
        }
        stack.push_back(distright(cur, nextsame[cur]));
      } else if (prevdir[index][1] == 0) {
        int cur = index;
        while (nextsame[cur] != uusind) {
          stack.push_back(distright(cur, nextsame[cur]));
          cur = nextsame[cur];
        }
        while (prevsame[cur] != uusind) {
          stack.push_back(-distleft(cur, prevsame[cur]));
          cur = prevsame[cur];
        }
        stack.push_back(-distleft(cur, prevsame[cur]));
      } else if (prevdir[index][1] == 2) {
        int cur = index;
        while (nextsame[cur] != index) {
          stack.push_back(distright(cur, nextsame[cur]));
          cur = nextsame[cur];
        }
        if (cur != uusind) {
          while (prevsame[cur] != uusind) {
            stack.push_back(-distleft(cur, prevsame[cur]));
            cur = prevsame[cur];
          }
          stack.push_back(-distleft(cur, prevsame[cur]));
        }
      } else {
        int cur = index;
        while (prevsame[cur] != index) {
          stack.push_back(-distleft(cur, prevsame[cur]));
          cur = prevsame[cur];
        }
        if (cur != uusind) {
          while (nextsame[cur] != uusind) {
            stack.push_back(distright(cur, nextsame[cur]));
            cur = nextsame[cur];
          }
          stack.push_back(distright(cur, nextsame[cur]));
        }
      }
      index = uusind;
    }
    if (a[index] > 1) {
      int uusind = prevstate[index][0];
      if (prevdir[index][0] == 1) {
        stack.push_back(distright(index, nextsmall[index]));
        index = nextsmall[index];
      } else {
        stack.push_back(-distleft(index, prevsmall[index]));
        index = prevsmall[index];
      }
    } else {
      if (distright(index, s) <= distleft(index, s)) {
        stack.push_back(distright(index, s));
      } else {
        stack.push_back(-distleft(index, s));
      }
      break;
    }
  }
  int kohta = s;
  int lisa = 0;
  while (stack.size() > 0) {
    if (stack.back() > 0) {
      kohta -= stack.back();
      kohta += n;
      kohta %= n;
      if (!visited[kohta]) {
        cout << -(stack.back() + lisa) << "\n";
        visited[kohta] = true;
        lisa = 0;
      } else {
        lisa += stack.back();
      }
    } else {
      kohta += -stack.back();
      kohta += n;
      kohta %= n;
      if (!visited[kohta]) {
        cout << "+" << -(stack.back() - lisa) << "\n";
        visited[kohta] = true;
        lisa = 0;
      } else {
        lisa += -stack.back();
      }
    }
    stack.pop_back();
  }
}