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;
const int N = 2e5 + 5, mod = 1e9 + 7;
int n, s, a[2005], dp[2005][2];
set<int> st;
int sh_path(int a, int b) {
  if (a > b) swap(a, b);
  return min(b - a, n - b + a);
}
void print_path(int a, int b) {
  if (abs(b - a) <= n - abs(-b + a)) {
    cout << (a > b ? '-' : '+');
    cout << abs(a - b) << endl;
  } else {
    cout << (a > b ? '+' : '-');
    cout << n - abs(a - b) << endl;
  }
}
int solve(int idx, bool done) {
  if (dp[idx][done] != -1) return dp[idx][done];
  int &ret = dp[idx][done];
  ret = 1e9;
  if (done) {
    auto it = st.upper_bound(a[idx]);
    if (it == st.end()) return ret = 0;
    int val = *it;
    for (int i = 0; i < n; i++) {
      if (a[i] == val) {
        ret = min(ret, sh_path(idx, i) + solve(i, 0));
      }
    }
    return ret;
  }
  vector<int> v;
  int start;
  for (int i = 0; i < n; i++) {
    if (a[i] == a[idx]) {
      v.push_back(i);
    }
    if (i == idx) start = (int)v.size() - 1;
  }
  if (v.size() == 1) return ret = solve(idx, 1);
  start += (int)v.size();
  int kam = v.size();
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < kam; j++) {
      v.push_back(v[j]);
    }
  }
  vector<int> cum(v.size(), 0);
  for (int i = 1; i < (int)v.size(); i++) {
    cum[i] = cum[i - 1] + sh_path(v[i], v[i - 1]);
  }
  for (int i = 0; i < kam; i++) {
    int dis = (cum[i + start] - cum[start]) * 2 + cum[start] -
              cum[start - kam + i + 1];
    ret = min(ret, dis + solve(v[start - kam + i + 1], 1));
    int dis2 = (cum[i + start] - cum[start]) +
               (cum[start] - cum[start - kam + i + 1]) * 2;
    ret = min(ret, dis2 + solve(v[i + start], 1));
  }
  return ret;
}
vector<int> ans;
void build(int idx, bool done) {
  int &ret = dp[idx][done];
  if (done) {
    auto it = st.upper_bound(a[idx]);
    if (it == st.end()) return;
    int val = *it;
    for (int i = 0; i < n; i++) {
      if (a[i] == val && sh_path(idx, i) + solve(i, 0) == ret) {
        print_path(idx, i);
        build(i, 0);
        return;
      }
    }
    return;
  }
  vector<int> v;
  int start;
  for (int i = 0; i < n; i++) {
    if (a[i] == a[idx]) {
      v.push_back(i);
    }
    if (i == idx) start = (int)v.size() - 1;
  }
  if (v.size() == 1) {
    build(idx, 1);
    return;
  }
  start += (int)v.size();
  int kam = v.size();
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < kam; j++) {
      v.push_back(v[j]);
    }
  }
  vector<int> cum(v.size(), 0);
  for (int i = 1; i < (int)v.size(); i++) {
    cum[i] = cum[i - 1] + sh_path(v[i], v[i - 1]);
  }
  for (int i = 0; i < kam; i++) {
    int dis = (cum[i + start] - cum[start]) * 2 + cum[start] -
              cum[start - kam + i + 1];
    if (dis + solve(v[start - kam + i + 1], 1) == ret) {
      for (int j = 1; j <= i; j++) print_path(v[start + j - 1], v[start + j]);
      if (kam - 1 != i) print_path(v[start + i], v[start - 1]);
      for (int j = 2; j <= kam - i - 1; j++)
        print_path(v[start - j + 1], v[start - j]);
      build(v[start - kam + i + 1], 1);
      return;
    }
    int dis2 = (cum[i + start] - cum[start]) +
               (cum[start] - cum[start - kam + i + 1]) * 2;
    if (dis2 + solve(v[i + start], 1) == ret) {
      for (int j = 1; j <= kam - i - 1; j++)
        print_path(v[start - j + 1], v[start - j]);
      if (0 != i) print_path(v[start - (kam - i - 1)], v[start + 1]);
      for (int j = 2; j <= i; j++) print_path(v[start + j - 1], v[start + j]);
      build(v[i + start], 1);
      return;
    }
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  s--;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    st.insert(a[i]);
  }
  memset(dp, -1, sizeof dp);
  int ans = 1e9;
  for (int i = 0; i < n; i++) {
    if (a[i] == *st.begin()) {
      ans = min(ans, solve(i, 0) + sh_path(i, s));
    }
  }
  cout << ans << '\n';
  for (int i = 0; i < n; i++) {
    if (a[i] == *st.begin() && ans == solve(i, 0) + sh_path(i, s)) {
      print_path(s, i);
      build(i, 0);
      break;
    }
  }
  return 0;
}