#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000 + 5;
const int INF = 1 << 30;
int dp[MAXN][2], a[MAXN], b[MAXN], num[MAXN][MAXN];
int n, s, m;
int clockwise(int l, int r) { return (r - l + n) % n; }
void print(int u, int k) {
  if (!num[a[u] + 1][0] && k == 1) return;
  if (!k) {
    int m = num[a[u]][0];
    int l = lower_bound(num[a[u]] + 1, num[a[u]] + m + 1, u) - num[a[u]];
    l = l == 1 ? num[a[u]][m] : num[a[u]][l - 1];
    if (dp[u][k] == dp[l][1] + clockwise(u, l)) {
      l = lower_bound(num[a[u]] + 1, num[a[u]] + m + 1, u) - num[a[u]];
      l = l == m ? 1 : l + 1;
      int last = u;
      for (int i = l; num[a[u]][i] != u; i = i == m ? 1 : i + 1) {
        printf("+%d\n", clockwise(last, num[a[u]][i]));
        last = num[a[u]][i];
      }
      print(last, 1);
    } else {
      l = lower_bound(num[a[u]] + 1, num[a[u]] + m + 1, u) - num[a[u]];
      l = l == 1 ? m : l - 1;
      int last = u;
      for (int i = l; num[a[u]][i] != u; i = i == 1 ? m : i - 1) {
        printf("-%d\n", clockwise(num[a[u]][i], last));
        last = num[a[u]][i];
      }
      print(last, 1);
    }
  } else {
    for (int i = 1; i <= num[a[u] + 1][0]; ++i) {
      int j = num[a[u] + 1][i], cw = clockwise(u, j), cc = clockwise(j, u);
      if (dp[u][k] == dp[j][0] + cw) {
        printf("+%d\n", cw);
        print(j, 0);
        break;
      } else if (dp[u][k] == dp[j][0] + cc) {
        printf("-%d\n", cc);
        print(j, 0);
        break;
      }
    }
  }
}
int dfs(int u, int k) {
  if (~dp[u][k]) return dp[u][k];
  int &ret = dp[u][k];
  ret = INF;
  if (!k) {
    int m = num[a[u]][0];
    int l = lower_bound(num[a[u]] + 1, num[a[u]] + m + 1, u) - num[a[u]];
    int r = upper_bound(num[a[u]] + 1, num[a[u]] + m + 1, u) - num[a[u]];
    l = l == 1 ? num[a[u]][m] : num[a[u]][l - 1];
    r = r == m + 1 ? num[a[u]][1] : num[a[u]][r];
    ret =
        min(ret, min(clockwise(u, l) + dfs(l, 1), clockwise(r, u) + dfs(r, 1)));
  } else {
    for (int i = 1; i <= num[a[u] + 1][0]; ++i) {
      int j = num[a[u] + 1][i];
      ret = min(ret, dfs(j, 0) + min(clockwise(u, j), clockwise(j, u)));
    }
  }
  return ret;
}
int main() {
  while (~scanf("%d%d", &n, &s)) {
    --s;
    memset(dp, -1, sizeof(dp));
    for (int i = 0; i < n; ++i) {
      scanf("%d", a + i);
      b[i] = a[i];
      num[i][0] = 0;
    }
    num[n][0] = 0;
    sort(b, b + n);
    int m = unique(b, b + n) - b;
    for (int i = 0; i < n; ++i) {
      int k = lower_bound(b, b + m, a[i]) - b;
      a[i] = k;
      num[k][++num[k][0]] = i;
      if (k == m - 1) dp[i][1] = 0;
    }
    int ans = INF;
    for (int i = 0; i < n; ++i) {
      if (!a[i]) {
        ans =
            min(ans,
                (dfs(i, 0) + min(clockwise(i, s), clockwise(s, i))) * MAXN + i);
      }
    }
    printf("%d\n", ans / MAXN);
    int pos = ans % MAXN;
    if (ans == (dp[pos][0] + clockwise(s, pos)) * MAXN + pos)
      printf("+%d\n", clockwise(s, pos));
    else
      printf("-%d\n", clockwise(pos, s));
    print(pos, 0);
  }
  return 0;
}
