#include <bits/stdc++.h>
using namespace std;
int n, s, ds;
int a[2010], lst[2010][2010], nxt[2010][2010], dp[2010][2010][2];
void read() {
  cin >> n >> s;
  --s;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
}
void normalize() {
  vector<pair<int, int> > v;
  for (int i = 0; i < n; ++i) {
    v.push_back(make_pair(a[i], i));
  }
  sort(v.begin(), v.end());
  ds = 0;
  for (int i = 0; i < v.size(); ++i) {
    if (i != 0 && v[i].first != v[i - 1].first) ++ds;
    a[v[i].second] = ds;
  }
}
void precalc() {
  for (int i = 0; i <= ds; ++i) {
    int last = -1;
    for (int j = 0, times = 0; times < 2 * n;
         j = j < n - 1 ? j + 1 : 0, ++times) {
      lst[i][j] = last;
      if (a[j] == i) last = j;
    }
    last = -1;
    for (int j = n - 1, times = 0;
         times<2 * n; j = j> 0 ? j - 1 : n - 1, ++times) {
      nxt[i][j] = last;
      if (a[j] == i) last = j;
    }
  }
}
int dist(int i, int j) { return (j - i + n) % n; }
struct source {
  int i, j, k;
  source() : i(-1), j(-1), k(-1) {}
  source(int i, int j, int k) : i(i), j(j), k(k) {}
} from[2010][2010][2];
void update(int i2, int j2, int k2, int i1, int j1, int k1, int val) {
  if (dp[i1][j1][k1] + val < dp[i2][j2][k2]) {
    dp[i2][j2][k2] = dp[i1][j1][k1] + val;
    from[i2][j2][k2] = source(i1, j1, k1);
  }
}
void printDist(int a, int b) {
  if (dist(a, b) < dist(b, a)) {
    cout << '+' << dist(a, b);
  } else {
    cout << '-' << dist(b, a);
  }
  cout << "\n";
}
void rec(int i, int j, int k) {
  if (i == -1) {
    return;
  }
  int fi = from[i][j][k].i, fj = from[i][j][k].j, fk = from[i][j][k].k;
  rec(fi, fj, fk);
  int cr = (k == 0 ? i : j);
  int fcr;
  if (fi == -1)
    fcr = s;
  else
    fcr = (fk == 0 ? fi : fj);
  printDist(fcr, cr);
}
void solve() {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < 2; ++k) {
        dp[i][j][k] = 1000000000;
      }
    }
  }
  int ans = 1000000000;
  source ansSource;
  if (a[s] == 0) {
    dp[s][s][0] = 0;
  } else {
    dp[nxt[0][s]][nxt[0][s]][0] = dist(s, nxt[0][s]);
    dp[lst[0][s]][lst[0][s]][0] =
        min(dp[lst[0][s]][lst[0][s]][0], dist(lst[0][s], s));
  }
  for (int i = 0; i <= ds; ++i) {
    vector<int> good;
    for (int j = 0; j < n; ++j) {
      if (a[j] == i) good.push_back(j);
    }
    for (int len = 1; len <= n; ++len) {
      for (int j = 0; j < good.size(); ++j) {
        for (int k = 0; k < 2; ++k) {
          int now = good[j];
          int then = (now + len - 1) % n;
          int current = (k == 0 ? now : then);
          if (dp[now][then][k] == 1000000000) continue;
          int nxt1 = lst[i][now];
          int nxt2 = nxt[i][then];
          if (nxt1 == then) {
            if (i == ds) {
              if (ans > dp[now][then][k]) {
                ans = dp[now][then][k];
                ansSource = source(now, then, k);
              }
            } else {
              nxt1 = lst[i + 1][now];
              nxt2 = nxt[i + 1][now];
              update(nxt1, nxt1, 0, now, then, k, dist(nxt1, current));
              update(nxt2, nxt2, 0, now, then, k, dist(current, nxt2));
            }
          } else {
            update(nxt1, then, 0, now, then, k, dist(nxt1, current));
            update(now, nxt2, 1, now, then, k, dist(current, nxt2));
          }
        }
      }
    }
  }
  cout << ans << "\n";
  rec(ansSource.i, ansSource.j, ansSource.k);
}
int main() {
  read();
  normalize();
  precalc();
  solve();
}
