#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e3 + 10;
int n, s;
int a[MAXN], lisan[MAXN];
int f[MAXN], g[MAXN];
int to_g[MAXN];
vector<int> to_f[MAXN];
bool clwz[MAXN];
inline int dist(int x, int y) { return min(abs(x - y), n - abs(x - y)); }
inline int odist(int x, int y) { return (y - x + n) % n; }
inline int codist(int x, int y) { return (x - y + n) % n; }
inline vector<int> find(int val) {
  vector<int> res;
  res.clear();
  for (int i = 1; i <= n; i++)
    if (a[i] == val) res.push_back(i);
  return res;
}
inline void calc_g(int x) {
  vector<int> S = find(a[x] + 1);
  for (int i = 0; i < (int)S.size(); i++) {
    int pos = S[i];
    int val = f[pos] + dist(pos, x);
    if (val < g[x]) {
      g[x] = val;
      to_g[x] = pos;
    }
  }
}
inline void calc_f(int x) {
  vector<int> S = find(a[x]);
  if ((int)S.size() == 1) return f[x] = g[x], (void)0;
  sort(S.begin(), S.end());
  int px = lower_bound(S.begin(), S.end(), x) - S.begin();
  int lst = px - 1, nxt = px + 1;
  if (lst == -1) lst = (int)S.size() - 1;
  if (nxt == (int)S.size()) nxt = 0;
  int val1 = g[S[lst]] + odist(x, S[lst]);
  int val2 = g[S[nxt]] + odist(S[nxt], x);
  if (val1 < val2) {
    f[x] = val1;
    int cur = nxt;
    while (cur != px) {
      to_f[x].push_back(S[cur]);
      cur++;
      if (cur == (int)S.size()) cur = 0;
    }
    clwz[x] = true;
  } else {
    f[x] = val2;
    int cur = lst;
    while (cur != px) {
      to_f[x].push_back(S[cur]);
      cur--;
      if (cur == -1) cur = (int)S.size() - 1;
    }
    clwz[x] = false;
  }
}
inline void pt_dist(int x, int y) {
  int dis = dist(x, y);
  if ((x + dis - 1) % n + 1 == y)
    printf("+%d\n", dis);
  else
    printf("-%d\n", dis);
}
inline void pt_odist(int x, int y) {
  int odis = odist(x, y);
  printf("+%d\n", odis);
}
inline void pt_codist(int x, int y) {
  int codis = codist(x, y);
  printf("-%d\n", codis);
}
inline void print_ans(int x, bool flag) {
  if (!to_g[x] && flag) return;
  if (flag || (f[x] == g[x] && (int)to_f[x].size() == 0)) {
    if (to_g[x] == 0) return;
    pt_dist(x, to_g[x]);
    print_ans(to_g[x], 0);
  } else {
    int lst = x;
    int len = (int)to_f[x].size();
    for (int i = 0; i < len; i++) {
      int pos = to_f[x][i];
      if (clwz[x])
        pt_odist(lst, pos);
      else
        pt_codist(lst, pos);
      lst = pos;
    }
    print_ans(to_f[x][len - 1], 1);
  }
}
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), lisan[i] = a[i];
  sort(lisan + 1, lisan + n + 1);
  int p = unique(lisan + 1, lisan + n + 1) - lisan - 1;
  for (int i = 1; i <= n; i++)
    a[i] = lower_bound(lisan + 1, lisan + p + 1, a[i]) - lisan;
  int Mx = 0;
  for (int i = 1; i <= n; i++) Mx = max(Mx, a[i]);
  memset(f, 0x3f, sizeof(f));
  memset(g, 0x3f, sizeof(g));
  for (int i = 1; i <= n; i++)
    if (a[i] == Mx) g[i] = 0;
  for (int i = 1; i <= n; i++)
    if (a[i] == Mx) calc_f(i);
  for (int i = Mx - 1; i >= 1; i--) {
    vector<int> S = find(i);
    for (int j = 0; j < (int)S.size(); j++) calc_g(S[j]);
    for (int j = 0; j < (int)S.size(); j++) calc_f(S[j]);
  }
  vector<int> S = find(1);
  int ans = 1e9, ansp = -1;
  for (int i = 0; i < (int)S.size(); i++) {
    int pos = S[i];
    int val = f[pos] + dist(s, pos);
    if (ans > val) {
      ans = val;
      ansp = pos;
    }
  }
  printf("%d\n", ans);
  pt_dist(s, ansp);
  print_ans(ansp, 0);
  return 0;
}
