#include <bits/stdc++.h>
using namespace std;
int n;
int dis(int a, int b) {
  while (a > b) b += n;
  return b - a;
}
int main() {
  ios_base::sync_with_stdio(false);
  int s, cnt = 0;
  cin >> n >> s;
  s--;
  vector<int> v(n);
  map<int, int> com;
  for (int((i)) = (0); ((i)) < ((n)); ((i))++) {
    cin >> v[i];
    com[v[i]] = 0;
  }
  for (auto(it) = (com).begin(); (it) != (com).end(); (it)++)
    it->second = cnt++;
  vector<int> am(cnt, 0);
  for (int((i)) = (0); ((i)) < ((n)); ((i))++) v[i] = com[v[i]], am[v[i]]++;
  vector<vector<int> > dp(n, vector<int>(cnt + 1, 1e9)),
      ans(n, vector<int>(cnt + 1, 0));
  for (int((i)) = (0); ((i)) < ((n)); ((i))++) dp[i][cnt] = 0;
  for (int((c)) = ((cnt - 1)); ((c)) >= (0); ((c))--) {
    int st = -1, en = 0, have = 0;
    for (int((i)) = (0); ((i)) < ((n)); ((i))++)
      if (v[i] == c) {
        en = i;
        if (st == -1) st = i;
      }
    int ST = st, EN = en;
    for (int i = (st + 1) % n;; i = (i + 1) % n) {
      if (v[i] == c) {
        en = st, st = i;
        int nb = dis(st, en) + dp[en][c + 1];
        if (nb < dp[st][c]) dp[st][c] = nb, ans[st][c] = dis(st, en);
      }
      if (i == ST) break;
    }
    st = EN, en = ST;
    for (int i = (st - 1) % n;; i = (i + n - 1) % n) {
      if (v[i] == c) {
        en = st, st = i;
        int nb = dis(en, st) + dp[en][c + 1];
        if (nb < dp[st][c]) dp[st][c] = nb, ans[st][c] = -dis(en, st);
      }
      if (i == EN) break;
    }
    int best = 1e9, dist = 0;
    for (int((_)) = (0); ((_)) < ((2 * n)); ((_))++) {
      int i = _ % n;
      best++, dist++;
      if (dp[i][c] < best) best = dp[i][c], dist = 0;
      if (best < dp[i][c]) dp[i][c] = best, ans[i][c] = -dist;
    }
    best = 1e9, dist = 0;
    for (int((_)) = ((2 * n - 1)); ((_)) >= (0); ((_))--) {
      int i = _ % n;
      best++, dist++;
      if (dp[i][c] < best) best = dp[i][c], dist = 0;
      if (best < dp[i][c]) dp[i][c] = best, ans[i][c] = dist;
    }
  }
  cout << endl << dp[s][0] << "\n";
  int cur = 0, c = 0, last = s, ne = 0, dir = 0;
  vector<int> taken(n, 0);
  while (c != cnt) {
    while (cur != am[c]) {
      if (v[s] == c && !taken[s]) {
        cur++;
        taken[s] = 1;
        if (dir < 0)
          cout << "-" << dis(s, last) << "\n";
        else
          cout << "+" << dis(last, s) << "\n";
        last = s;
      }
      if (ne == 0)
        ne = dir = ans[s][c];
      else {
        s = (s + (ne < 0 ? -1 : 1) + n) % n;
        ne += ne < 0 ? 1 : -1;
      }
    }
    cur = ne = 0;
    last = s;
    c++;
  }
}
