#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  long long r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long fpow(long long n, long long k, int p = (int)1e9 + 7) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = 2 * acos((long double)0);
const int maxn = 2010;
int n, s;
int a[maxn];
map<int, int> dc;
vector<int> g[maxn];
int f[maxn];
pair<pair<int, int>, int> rb[maxn];
int dist(int i, int j) { return min(abs(i - j), n - abs(i - j)); }
int dist2(int i, int j) {
  int res = j - i;
  if (res <= 0) res += n;
  return res;
}
vector<int> trace(int p, int q, int dir) {
  vector<int> res;
  res.push_back(q);
  if (dir == 1) {
    while (q != p) {
      q = (q + 1) % n;
      if (a[q] == a[p]) {
        res.push_back(q);
      }
    }
  } else {
    while (q != p) {
      q = (q + n - 1) % n;
      if (a[q] == a[p]) {
        res.push_back(q);
      }
    }
  }
  return res;
}
void solve() {
  scanf("%d%d", &n, &s);
  s--;
  for (int i = (0); i < (n); i++) {
    scanf("%d", a + i);
    dc[a[i]];
  }
  int cnt = 0;
  for (__typeof((dc).begin()) it = (dc).begin(); it != (dc).end(); it++)
    it->second = cnt++;
  for (int i = (0); i < (n); i++) {
    a[i] = dc[a[i]];
    g[a[i]].push_back(i);
  }
  memset(f, 0x3f, sizeof(f));
  for (int i = (0); i < (int((g[0]).size())); i++) {
    int u = g[0][i];
    f[u] = dist(s, u);
    rb[u] = make_pair(make_pair(-1, s), 0);
  }
  for (int i = (1); i < (cnt); i++) {
    for (int j = (0); j < (int((g[i]).size())); j++) {
      int u = g[i][j];
      for (int k = (0); k < (int((g[i - 1]).size())); k++) {
        int p = g[i - 1][k];
        int q = g[i - 1][(k + 1) % int((g[i - 1]).size())];
        int d = dist2(p, q);
        int x = f[p] + n - dist2(p, q) + dist(u, q);
        int y = f[q] + n - dist2(p, q) + dist(u, p);
        if (f[u] > x) {
          f[u] = x;
          rb[u] = make_pair(make_pair(p, q), 1);
        }
        if (f[u] > y) {
          f[u] = y;
          rb[u] = make_pair(make_pair(q, p), -1);
        }
      }
    }
  }
  int ans = INF, r1, r2, dir;
  for (int i = (0); i < (int((g[cnt - 1]).size())); i++) {
    int p = g[cnt - 1][i];
    int q = g[cnt - 1][(i + 1) % int((g[cnt - 1]).size())];
    int x = f[p] + n - dist2(p, q);
    int y = f[q] + n - dist2(p, q);
    if (ans > x) {
      ans = x;
      r1 = p;
      r2 = q;
      dir = 1;
    }
    if (ans > y) {
      ans = y;
      r1 = q;
      r2 = p;
      dir = -1;
    }
  }
  printf("%d\n", ans);
  vector<int> res;
  for (int _ = (0); _ < (cnt); _++) {
    vector<int> r = trace(r1, r2, dir);
    for (int i = (0); i < (int((r).size())); i++) res.push_back(r[i]);
    pair<pair<int, int>, int> p = rb[r1];
    r1 = p.first.first;
    r2 = p.first.second;
    dir = p.second;
  }
  res.push_back(r2);
  reverse((res).begin(), (res).end());
  for (int i = (0); i < (int((res).size()) - 1); i++) {
    if (res[i] <= res[i + 1] && res[i + 1] - res[i] == dist(res[i], res[i + 1]))
      printf("+");
    else if (res[i] >= res[i + 1] &&
             res[i] - res[i + 1] != dist(res[i], res[i + 1]))
      printf("+");
    else
      printf("-");
    printf("%d\n", dist(res[i], res[i + 1]));
  }
}
int main() {
  solve();
  return 0;
}
