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>
std::mt19937 rng(
    (int)std::chrono::steady_clock::now().time_since_epoch().count());
int size;
int closest(int x) {
  x = (x % size + size) % size;
  return std::min(x, size - x);
}
int closest(int a, int b) { return closest(a - b); }
struct Group {
  std::vector<int> a;
  int n = 0;
  void push_back(int x) {
    a.push_back(x);
    n++;
  }
  std::vector<std::vector<int>> dp;
  std::vector<std::vector<std::pair<int, int>>> to;
  void init() {
    dp.assign(2 * n + 1, std::vector<int>(2 * n + 1, -1));
    to.assign(2 * n + 1, std::vector<std::pair<int, int>>(2 * n + 1));
    for (int i = 0; i < n; i++) {
      a.push_back(a[i] + size);
    }
  }
  int dist(int i, int j) { return closest(a[j] - a[i]); }
  template <class F>
  void calc(F f) {
    init();
    for (int d = 1; d <= 2 * n; d++) {
      for (int l = 0; l + d <= 2 * n; l++) {
        int r = l + d;
        if (d == 1) {
          auto got = f(a[l]);
          dp[l][r] = dp[r][l] = got.first;
          to[l][r] = to[r][l] = got.second;
        } else {
          dp[l][r] = std::min(dp[l + 1][r] + dist(l, l + 1),
                              dp[r][l + 1] + dist(l, r - 1));
          if (dp[l][r] == dp[l + 1][r] + dist(l, l + 1)) {
            to[l][r] = std::pair<int, int>(l + 1, r);
          } else {
            to[l][r] = std::pair<int, int>(r, l + 1);
          }
          dp[r][l] = std::min(dp[l][r - 1] + dist(r - 1, l),
                              dp[r - 1][l] + dist(r - 1, r - 2));
          if (dp[r][l] == dp[l][r - 1] + dist(r - 1, l)) {
            to[r][l] = std::pair<int, int>(l, r - 1);
          } else {
            to[r][l] = std::pair<int, int>(r - 1, l);
          }
        }
      }
    }
  }
};
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  int n, s;
  std::cin >> n >> s;
  size = n;
  std::map<int, Group> mp;
  mp[-1000000100].push_back(s - 1);
  for (int i = 0; i < n; i++) {
    int x;
    std::cin >> x;
    mp[x].push_back(i);
  }
  std::vector<Group> a;
  for (auto it : mp) a.push_back(it.second);
  n = (int)a.size();
  for (int i = n - 1; i >= 0; i--) {
    if (i + 1 == n) {
      a[i].calc([](int x) {
        return std::pair<int, std::pair<int, int>>(0,
                                                   std::pair<int, int>(x, x));
      });
    } else {
      a[i].calc([&](int x) {
        std::pair<int, std::pair<int, int>> ans(1e9,
                                                std::pair<int, int>(-1, -1));
        for (int j = 0; j < a[i + 1].n; j++) {
          int d = closest(x, a[i + 1].a[j]) + a[i + 1].dp[j][j + a[i + 1].n];
          if (d < ans.first) {
            ans.first = d;
            ans.second = std::pair<int, int>(j, j + a[i + 1].n);
          }
        }
        return ans;
      });
    }
  }
  std::cout << a[0].dp[0][a[0].n] << '\n';
  s--;
  for (int i = 0, l = 0, r = a[0].n; i < n; i++) {
    for (int rep = 0; rep < a[i].n; rep++) {
      std::tie(l, r) = a[i].to[l][r];
      if (l != r) {
        int nxt = l < r ? l : l - 1;
        nxt = rep + 1 == a[i].n ? a[i + 1].a[nxt] : a[i].a[nxt];
        nxt %= size;
        int dist = (nxt - s + 3 * size) % size;
        if (dist <= size - dist) {
          std::cout << "+" << dist << '\n';
        } else {
          std::cout << "-" << size - dist << '\n';
        }
        s = nxt;
      }
    }
  }
}