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>
const int MAXN = 2000 + 5;
int n, s, a[MAXN], m;
std::vector<int> S;
int f[MAXN][MAXN];
std::vector<int> G[MAXN];
inline int dis(int i, int j) {
  if (i < j) std::swap(i, j);
  return std::min(i - j, n - i + j);
}
int g[MAXN];
int p1[MAXN][MAXN], p2[MAXN][MAXN];
int ps[MAXN];
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i), S.push_back(a[i]);
  std::sort(S.begin(), S.end());
  S.erase(std::unique(S.begin(), S.end()), S.end());
  for (int i = 1; i <= n; ++i)
    a[i] = std::lower_bound(S.begin(), S.end(), a[i]) - S.begin() + 1;
  for (int i = 1; i <= n; ++i)
    G[a[i]].push_back(i), ps[i] = ((int)G[a[i]].size()) - 1;
  m = S.size();
  memset(f, 0x3f, sizeof(f));
  G[0].push_back(s);
  f[0][s] = 0;
  for (int i = 1; i <= m; ++i) {
    if (G[i].size() == 1) {
      for (auto x : G[i - 1]) {
        if (f[i][G[i][0]] > f[i - 1][x] + dis(x, G[i][0])) {
          f[i][G[i][0]] = f[i - 1][x] + dis(x, G[i][0]);
          p1[i][G[i][0]] = x;
        }
      }
      continue;
    }
    memset(g, 0x3f, sizeof(g));
    for (auto x : G[i - 1])
      for (auto y : G[i]) {
        if (g[y] > f[i - 1][x] + dis(x, y)) {
          g[y] = f[i - 1][x] + dis(x, y);
          p1[i][y] = x;
        }
      }
    for (int x = 0; x <= ((int)G[i].size()) - 1; ++x) {
      for (int d = -1; d <= 1; d += 2) {
        int y = (x + d + ((int)G[i].size())) % ((int)G[i].size()), gx = 0;
        if (d == -1)
          gx = G[i][x] - G[i][y];
        else
          gx = G[i][y] - G[i][x];
        if (gx < 0) gx += n;
        gx = n - gx;
        if (f[i][G[i][y]] > g[G[i][x]] + gx) {
          f[i][G[i][y]] = g[G[i][x]] + gx;
          p2[i][G[i][y]] = d == -1 ? 1 : -1;
        }
      }
    }
  }
  int ans = 1e9, j = -1;
  for (auto x : G[m]) {
    if (ans > f[m][x]) {
      ans = f[m][x];
      j = x;
    }
  }
  printf("%d\n", ans);
  std::vector<std::pair<int, int> > S;
  for (int i = m; i >= 1; --i) {
    auto gao = [&](int x, int y) {
      bool flag = x < y;
      if (x < y) std::swap(x, y);
      if (x - y <= n - x + y)
        S.push_back(std::make_pair(1, x - y));
      else
        S.push_back(std::make_pair(0, n - x + y));
      S.back().first ^= flag;
    };
    if (G[i].size() == 1) {
      gao(G[i][0], p1[i][G[i][0]]);
      j = p1[i][G[i][0]];
      continue;
    }
    int y = (ps[j] + p2[i][j] + ((int)G[i].size())) % ((int)G[i].size()),
        p = ps[j];
    if (p2[i][j] == -1) {
      while (p != y) {
        int d = G[i][(p + 1) % ((int)G[i].size())] - G[i][p];
        if (d < 0) d += n;
        S.push_back(std::make_pair(0, d));
        (p += 1) %= ((int)G[i].size());
      }
    } else {
      while (p != y) {
        int d =
            G[i][p] - G[i][(p - 1 + ((int)G[i].size())) % ((int)G[i].size())];
        if (d < 0) d += n;
        S.push_back(std::make_pair(1, d));
        (p += ((int)G[i].size()) - 1) %= ((int)G[i].size());
      }
    }
    gao(G[i][y], p1[i][G[i][y]]);
    j = p1[i][G[i][y]];
  }
  std::reverse(S.begin(), S.end());
  for (auto x : S) {
    if (x.first == 1)
      printf("+%d\n", x.second);
    else
      printf("-%d\n", x.second);
  }
  static bool vis[MAXN];
  auto chk = [&]() {
    int now = 1, res = 0;
    std::sort(a + 1, a + n + 1);
    for (auto x : S) {
      if (x.first == 1)
        now = (now - 1 + x.second) % n + 1;
      else
        now = (now - 1 - x.second + n) % n + 1;
      assert(!vis[now]);
      vis[now] = 1;
      res += x.second;
    }
    assert(res == ans);
  };
  chk();
  return 0;
}