#include <bits/stdc++.h>
using namespace std;
int n, s;
int a[2020], b[2020], lshcnt;
int f[2020][2020], g[2020][2020];
pair<int, int> preg[2020][2020];
int pref[2020][2020];
int l[2020], r[2020], rev[2020], tag[2020];
vector<int> pos[2020];
inline int dis(int x, int y) {
  if (x <= y) return y - x;
  return n - x + y;
}
inline int mdis(int x, int y) { return min(dis(x, y), dis(y, x)); }
inline int mo(int x) {
  if (x > n) return x - n;
  return x;
}
void dfsg(int, int);
void dfsf(int p, int v) {
  int u = pref[p][v];
  dfsg(p - 1, u);
  if (dis(u, v) <= dis(v, u))
    printf("+%d\n", dis(u, v));
  else
    printf("-%d\n", dis(v, u));
}
void dfsg(int p, int v) {
  if (p == 0) return;
  int u = preg[p][v].first, way = preg[p][v].second;
  dfsf(p, u);
  if (pos[p].size() == 1) return;
  tag[u] = 1;
  int cur = u, out = 0;
  if (way == 0) {
    while (cur != l[v]) {
      out += dis(cur, r[cur]);
      cur = r[cur];
      if (!tag[cur]) {
        if (out >= 0)
          printf("+%d\n", out);
        else
          printf("-%d\n", -out);
        out = 0;
      }
      tag[cur] = 1;
    }
    while (cur != v) {
      out -= dis(l[cur], cur);
      cur = l[cur];
      if (!tag[cur]) {
        if (out >= 0)
          printf("+%d\n", out);
        else
          printf("-%d\n", -out);
        out = 0;
      }
      tag[cur] = 1;
    }
  } else {
    while (cur != r[v]) {
      out -= dis(l[cur], cur);
      cur = l[cur];
      if (!tag[cur]) {
        if (out >= 0)
          printf("+%d\n", out);
        else
          printf("-%d\n", out);
        out = 0;
      }
      tag[cur] = 1;
    }
    while (cur != v) {
      out += dis(cur, r[cur]);
      cur = r[cur];
      if (!tag[cur]) {
        if (out >= 0)
          printf("+%d\n", out);
        else
          printf("-%d\n", out);
        out = 0;
      }
      tag[cur] = 1;
    }
  }
}
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), b[i] = a[i];
  sort(b + 1, b + 1 + n);
  lshcnt = unique(b + 1, b + 1 + n) - b - 1;
  for (int i = 1; i <= n; ++i) {
    a[i] = lower_bound(b + 1, b + 1 + lshcnt, a[i]) - b;
    pos[a[i]].emplace_back(i);
    rev[i] = pos[a[i]].size() - 1;
  }
  for (int i = 1; i <= lshcnt; ++i) {
    l[pos[i].front()] = pos[i].back();
    r[pos[i].back()] = pos[i].front();
    for (int j = 0; j < pos[i].size(); ++j) {
      if (j) l[pos[i][j]] = pos[i][j - 1];
      if (j != pos[i].size() - 1) r[pos[i][j]] = pos[i][j + 1];
    }
  }
  memset(f, 0x3f, sizeof f);
  memset(g, 0x3f, sizeof g);
  g[0][s] = 0;
  pos[0].emplace_back(s);
  for (int i = 1; i <= lshcnt; ++i) {
    for (int p : pos[i])
      for (int q : pos[i - 1]) {
        int d = g[i - 1][q] + mdis(p, q);
        if (d < f[i][p]) {
          f[i][p] = d;
          pref[i][p] = q;
        }
      }
    if (pos[i].size() == 1) {
      g[i][pos[i][0]] = f[i][pos[i][0]];
      preg[i][pos[i][0]] = make_pair(pos[i][0], 2);
      continue;
    }
    for (int p : pos[i]) {
      for (int q : pos[i]) {
        if (p == q) continue;
        int d = f[i][p] + dis(p, l[q]) * 2 + dis(q, p);
        if (d < g[i][q]) {
          g[i][q] = d;
          preg[i][q] = make_pair(p, 0);
        }
        d = f[i][p] + dis(r[q], p) * 2 + dis(p, q);
        if (d < g[i][q]) {
          g[i][q] = d;
          preg[i][q] = make_pair(p, 1);
        }
      }
    }
  }
  int ans = 0x3f3f3f3f, u;
  for (int p : pos[lshcnt]) {
    if (g[lshcnt][p] < ans) {
      ans = g[lshcnt][p];
      u = p;
    }
  }
  printf("%d\n", ans);
  dfsg(lshcnt, u);
}
