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 GCC target("sse4,avx")
struct Prev {
  int index;
  int dir;
  int turn;
};
struct Solution {
  int n, s;
  std::vector<std::vector<int>> groups;
  std::vector<std::vector<int>> dyn;
  std::vector<std::vector<Prev>> prev;
  void group(const std::vector<std::pair<int, int>>& as) {
    groups.push_back(std::vector<int>{s});
    dyn.push_back(std::vector<int>(1));
    prev.push_back(std::vector<Prev>(1));
    int start = 0;
    for (int i = 1; i < n; i++) {
      if (as[i].first != as[start].first) {
        std::vector<int> group(i - start);
        for (int j = start; j < i; j++) {
          group[j - start] = as[j].second;
        }
        groups.push_back(group);
        dyn.push_back(std::vector<int>(group.size()));
        prev.push_back(std::vector<Prev>(group.size()));
        start = i;
      }
    }
    std::vector<int> group(n - start);
    for (int j = start; j < n; j++) {
      group[j - start] = as[j].second;
    }
    groups.push_back(group);
    dyn.push_back(std::vector<int>(group.size()));
    prev.push_back(std::vector<Prev>(group.size()));
  }
  void step(size_t gprev, size_t gcur) {
    std::fill(dyn[gcur].begin(), dyn[gcur].end(), 1000000000);
    for (size_t i = 0; i < groups[gprev].size(); i++) {
      int pos = groups[gprev][i];
      int dynBefore = dyn[gprev][i];
      for (size_t turn = 0; turn < groups[gcur].size(); turn++) {
        size_t before = (turn + groups[gcur].size() - 1) % groups[gcur].size();
        int dist = dynBefore + (pos - groups[gcur][turn] + n) % n +
                   (groups[gcur][before] + n - groups[gcur][turn]) % n;
        if (dyn[gcur][before] > dist) {
          dyn[gcur][before] = dist;
          prev[gcur][before].index = i;
          prev[gcur][before].dir = -1;
          prev[gcur][before].turn = turn;
        }
      }
      for (size_t turn = 0; turn < groups[gcur].size(); turn++) {
        size_t next = (turn + 1) % groups[gcur].size();
        int dist = dynBefore + (groups[gcur][turn] - pos + n) % n +
                   (groups[gcur][turn] - groups[gcur][next] + n) % n;
        if (dyn[gcur][next] > dist) {
          dyn[gcur][next] = dist;
          prev[gcur][next].index = i;
          prev[gcur][next].dir = 1;
          prev[gcur][next].turn = turn;
        }
      }
      size_t j = 0;
      while (j < groups[gcur].size() && groups[gcur][j] <= pos) {
        j++;
      }
      j %= groups[gcur].size();
      size_t prev_j = (j + groups[gcur].size() - 1) % groups[gcur].size();
      {
        int dist = dynBefore + (pos - groups[gcur][j] + n) % n;
        if (dyn[gcur][j] > dist) {
          dyn[gcur][j] = dist;
          prev[gcur][j].index = i;
          prev[gcur][j].dir = -1;
          prev[gcur][j].turn = -1;
        }
      }
      {
        int dist = dynBefore + (groups[gcur][prev_j] - pos + n - 1) % n + 1;
        if (dyn[gcur][prev_j] > dist) {
          dyn[gcur][prev_j] = dist;
          prev[gcur][prev_j].index = i;
          prev[gcur][prev_j].dir = 1;
          prev[gcur][prev_j].turn = -1;
        }
      }
    }
  }
  void run(std::istream& in, std::ostream& out) {
    in >> n >> s;
    s--;
    std::vector<std::pair<int, int>> as(n);
    for (int i = 0; i < n; i++) {
      in >> as[i].first;
      as[i].first--;
      as[i].second = i;
    }
    std::sort(as.begin(), as.end());
    group(as);
    for (size_t g = 1; g < groups.size(); g++) {
      step(g - 1, g);
    }
    size_t curG = groups.size() - 1;
    size_t curIndex = 0;
    int ans = dyn[curG][curIndex];
    for (size_t i = 1; i < dyn[curG].size(); i++) {
      if (dyn[curG][i] < ans) {
        ans = dyn[curG][i];
        curIndex = i;
      }
    }
    out << ans << std::endl;
    std::vector<std::pair<int, int>> answer;
    for (; curG > 0; curG--) {
      Prev info = prev[curG][curIndex];
      int pos = groups[curG - 1][info.index];
      std::vector<std::pair<int, int>> local;
      int firstIndex;
      int dir;
      if (info.dir == -1) {
        if (info.turn == -1) {
          int j = 0;
          while (j < groups[curG].size() && groups[curG][j] <= pos) j++;
          j = (j + groups[curG].size() - 1) % groups[curG].size();
          firstIndex = j;
          dir = -1;
          local.emplace_back(-1, (pos - groups[curG][j] + n) % n);
        } else {
          firstIndex = info.turn;
          local.emplace_back(-1, (pos - groups[curG][firstIndex] + n) % n);
          dir = 1;
        }
      } else {
        if (info.turn == -1) {
          int j = 0;
          while (j < groups[curG].size() && groups[curG][j] <= pos) j++;
          firstIndex = j;
          dir = 1;
          local.emplace_back(1, (groups[curG][j] - pos + n - 1) % n + 1);
        } else {
          firstIndex = info.turn;
          local.emplace_back(1, (groups[curG][firstIndex] - pos + n) % n);
          dir = -1;
        }
      }
      for (int j = 1; j < static_cast<int>(groups[curG].size()); j++) {
        int cur =
            (firstIndex + j * dir + groups[curG].size()) % groups[curG].size();
        int prev = (firstIndex + (j - 1) * dir + groups[curG].size()) %
                   groups[curG].size();
        local.emplace_back(
            dir, ((groups[curG][cur] - groups[curG][prev]) * dir + n) % n);
      }
      std::reverse(local.begin(), local.end());
      answer.insert(answer.end(), local.begin(), local.end());
      curIndex = info.index;
    }
    std::reverse(answer.begin(), answer.end());
    for (std::pair<int, int> move : answer) {
      if (move.first == 1) {
        out << "+";
      } else {
        out << "-";
      }
      out << move.second << "\n";
    }
  }
};
int main() {
  std::cin.sync_with_stdio(false);
  std::cin.tie(nullptr);
  Solution().run(std::cin, std::cout);
  return 0;
}