#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long a = 0, b = getchar(), c = 1;
  while (!isdigit(b)) c = b == '-' ? -1 : 1, b = getchar();
  while (isdigit(b)) a = a * 10 + b - '0', b = getchar();
  return a * c;
}
int n, m, a[2050], r[2050], z1[2050], z2[2050];
vector<pair<int, int> > q, g;
bool cmp(int x, int y) { return a[x] == a[y] ? (x < y) : (a[x] > a[y]); }
int jj(int x, int y) { return y - x < 0 ? y - x + n : y - x; }
int gg(int x, int y) { return x - y < 0 ? x - y + n : x - y; }
int ff(int x, int y) { return min(jj(x, y), gg(x, y)); }
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; i++) a[i] = read(), r[i] = i;
  sort(r + 1, r + n + 1, cmp);
  int li = 0, lj = 0;
  for (int i = 1, j = 1; i <= n; i = j) {
    for (; j <= n and a[r[j]] == a[r[i]];) j++;
    if (i == 1)
      for (int k = i; k < j; k++) z2[k] = 0;
    else
      for (int k = i; k < j; k++) {
        z2[k] = n * n;
        for (int p = li; p <= lj; p++)
          z2[k] = min(z2[k], z1[p] + ff(r[k], r[p]));
      }
    if (i == j - 1)
      z1[i] = z2[i];
    else
      for (int k = i; k < j; k++) {
        int t1 = k - 1 < i ? j - 1 : k - 1;
        int t2 = k + 1 >= j ? i : k + 1;
        z1[k] = min(z2[t1] + jj(r[k], r[t1]), z2[t2] + gg(r[k], r[t2]));
      }
    li = i, lj = j - 1;
    g.push_back(make_pair(li, lj));
  }
  int ans = n * n, st;
  for (int i = li; i <= lj; i++)
    if (z1[i] + ff(r[i], m) < ans) ans = z1[i] + ff(r[i], m), st = i;
  printf("%d\n", ans);
  q.push_back(make_pair(m, r[st]));
  bool begin = 0;
  while (!g.empty()) {
    pair<int, int> nw = g.back();
    g.pop_back();
    if (begin)
      for (int i = nw.first; i <= nw.second; i++) {
        if (z1[i] == z2[st] - ff(r[i], r[st])) {
          q.push_back(make_pair(r[st], r[i]));
          st = i;
          break;
        }
      }
    begin = 1;
    if (nw.first != nw.second) {
      int t1 = st - 1 < nw.first ? nw.second : st - 1;
      int t2 = st + 1 > nw.second ? nw.first : st + 1;
      int dir = -1;
      if (z2[t1] + jj(r[st], r[t1]) <= z2[t2] + gg(r[st], r[t2])) dir = 1;
      for (int i = nw.first; i < nw.second; i++) {
        int p = st + dir;
        if (p < nw.first) p = nw.second;
        if (p > nw.second) p = nw.first;
        q.push_back(make_pair(r[st], r[p]));
        st = p;
      }
    }
  }
  for (int i = 0; i < q.size(); i++) {
    int x = q[i].first, y = q[i].second;
    printf("%c%d\n", jj(x, y) > gg(x, y) ? '-' : '+', ff(x, y));
  }
  return 0;
}
