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;
using ll = long long;
using ld = long double;
using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;
template <class T>
T ceil(T x, T y) {
  assert(y >= 1);
  return (x > 0 ? (x + y - 1) / y : x / y);
}
template <class T>
T floor(T x, T y) {
  assert(y >= 1);
  return (x > 0 ? x / y : (x - y + 1) / y);
}
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(string &a) { cin >> a; }
template <class T, class S>
void scan(pair<T, S> &p) {
  scan(p.first), scan(p.second);
}
template <class T>
void scan(vector<T> &a) {
  for (auto &i : a) scan(i);
}
template <class T>
void scan(T &a) {
  cin >> a;
}
void IN() {}
template <class Head, class... Tail>
void IN(Head &head, Tail &...tail) {
  scan(head);
  IN(tail...);
}
vi s_to_vi(string S, char first_char = 'a') {
  vi A(S.size());
  for (ll i = 0; (i) < (ll)(S.size()); ++(i)) {
    A[i] = S[i] - first_char;
  }
  return A;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &A) {
  os << A.first << " " << A.second;
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &A) {
  for (size_t i = 0; i < A.size(); i++) {
    if (i) os << " ";
    os << A[i];
  }
  return os;
}
void print() { cout << "\n"; }
template <class Head, class... Tail>
void print(Head &&head, Tail &&...tail) {
  cout << head;
  if (sizeof...(Tail)) cout << " ";
  print(forward<Tail>(tail)...);
}
const string YESNO[2] = {"NO", "YES"};
const string YesNo[2] = {"No", "Yes"};
const string yesno[2] = {"no", "yes"};
void YES(bool t = 1) { cout << YESNO[t] << endl; }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { cout << YesNo[t] << endl; }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { cout << yesno[t] << endl; }
void no(bool t = 1) { yes(!t); }
template <typename T>
vector<T> cumsum(vector<T> A) {
  ll N = A.size();
  vector<T> B(N + 1);
  B[0] = T(0);
  for (ll i = 0; (i) < (ll)(N); ++(i)) {
    B[i + 1] = B[i] + A[i];
  }
  return B;
}
vi bin_count(vi &A, ll size) {
  vi C(size);
  for (auto &&x : A) {
    ++C[x];
  }
  return C;
}
template <typename T>
vi argsort(vector<T> &A) {
  vi ids(A.size());
  iota(ids.begin(), ids.end(), 0);
  sort(ids.begin(), ids.end(),
       [&](ll i, ll j) { return make_pair(A[i], i) <= make_pair(A[j], j); });
  return ids;
}
template <class T, class S>
inline bool chmax(T &a, const S &b) {
  return (a < b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chmin(T &a, const S &b) {
  return (a > b ? a = b, 1 : 0);
}
void solve() {
  int N, S;
  IN(N, S);
  --S;
  auto dist = [&](int i, int j) -> int {
    if (i > j) swap(i, j);
    return min(j - i, i - j + N);
  };
  vector<ll> A(N);
  IN(A);
  vi X = A;
  sort(X.begin(), X.end()), X.erase(unique(X.begin(), X.end()), X.end());
  for (auto &&x : A)
    x = distance((X).begin(), lower_bound(X.begin(), X.end(), (x)));
  int K = X.size();
  vvc<ll> ID(K);
  for (ll i = 0; (i) < (ll)(N); ++(i)) ID[A[i]].emplace_back(i);
  vi LEFT(N);
  vi RIGHT(N);
  for (ll x = 0; (x) < (ll)(K); ++(x)) {
    int n = ID[x].size();
    for (ll i = 0; (i) < (ll)(n); ++(i)) {
      int j = (i + 1 < n ? i + 1 : 0);
      int a = ID[x][i], b = ID[x][j];
      RIGHT[a] = b;
      LEFT[b] = a;
    }
  }
  const ll INF = 1LL << 60;
  vi DPS(N, INF);
  vi DPT(N, INF);
  vi PARS(N, -1);
  vi PART(N, -1);
  vi PAR_dir(N);
  for (auto &&i : ID[0]) {
    DPS[i] = dist(S, i);
  }
  for (ll x = 0; (x) < (ll)(K); ++(x)) {
    for (auto &&frm : ID[x]) {
      int to = LEFT[frm];
      int x = (frm <= to ? to - frm : to - frm + N);
      if (chmin(DPT[to], DPS[frm] + x)) {
        PART[to] = frm;
        PAR_dir[to] = 0;
      }
      to = RIGHT[frm];
      x = (to <= frm ? frm - to : frm - to + N);
      if (chmin(DPT[to], DPS[frm] + x)) {
        PART[to] = frm;
        PAR_dir[to] = 1;
      }
    }
    if (x == K - 1) break;
    for (auto &&frm : ID[x]) {
      for (auto &&to : ID[x + 1]) {
        if (chmin(DPS[to], DPT[frm] + dist(frm, to))) {
          PARS[to] = frm;
        }
      }
    }
  }
  ll ANS = INF;
  int v = -1;
  for (auto &&i : ID[K - 1])
    if (chmin(ANS, DPT[i])) v = i;
  print(ANS);
  vi HISTORY = {v};
  while (v >= 0) {
    int frm = PART[v];
    int d = PAR_dir[v];
    while (v != frm) {
      v = (d == 0 ? LEFT[v] : RIGHT[v]);
      HISTORY.emplace_back(v);
    }
    v = PARS[v];
    HISTORY.emplace_back(v);
  }
  HISTORY.back() = S;
  reverse(HISTORY.begin(), HISTORY.end());
  for (ll i = 0; (i) < (ll)(N); ++(i)) {
    int frm = HISTORY[i], to = HISTORY[i + 1];
    if (frm == to) {
      print("+0");
      continue;
    }
    int r = (frm <= to ? to - frm : to - frm + N);
    int l = (frm >= to ? frm - to : frm - to + N);
    if (l <= r)
      print("-" + to_string(l));
    else
      print("+" + to_string(r));
  }
}
signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(15);
  solve();
  return 0;
}