#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
int N, S;
int a[2005], cnt[2005];
int l[2005][2005], r[2005][2005];
int f[2][2005][2005], prv[2][2005][2005];
vector<int> ver, ret;
int distl(int i, int j) {
  if (i >= j)
    return i - j;
  else
    return N - (j - i);
}
int distr(int i, int j) {
  if (i <= j)
    return j - i;
  else
    return N - (i - j);
}
void update(int op1, int i1, int j1, int op2, int i2, int j2, int cost) {
  if (f[op2][i2][j2] + cost < f[op1][i1][j1] || f[op1][i1][j1] == -1) {
    f[op1][i1][j1] = f[op2][i2][j2] + cost;
    prv[op1][i1][j1] = j2;
  }
}
void path(int op, int i, int j) {
  if (op || i) {
    if (op)
      path(0, i, prv[op][i][j]);
    else
      path(1, i - 1, prv[op][i][j]);
  }
  ver.push_back(j);
}
int main() {
  scanf("%d%d", &N, &S);
  for (int i = 0; i < (int)(N); ++i) scanf("%d", &a[i]);
  for (int i = 0; i < (int)(N); ++i) ver.push_back(a[i]);
  sort(ver.begin(), ver.end());
  ver.erase(unique(ver.begin(), ver.end()), ver.end());
  for (int i = 0; i < (int)(N); ++i) {
    a[i] = lower_bound(ver.begin(), ver.end(), a[i]) - ver.begin();
    cnt[a[i]]++;
  }
  memset(l, -1, sizeof(l));
  memset(r, -1, sizeof(r));
  for (int i = 0; i < (int)(N); ++i) {
    for (int j = i - 1; j != i; --j) {
      if (j < 0) j += N;
      if (j == i) break;
      if (l[i][a[j]] == -1) l[i][a[j]] = j;
    }
    for (int j = i + 1; j != i; ++j) {
      if (j >= N) j -= N;
      if (j == i) break;
      if (r[i][a[j]] == -1) r[i][a[j]] = j;
    }
  }
  memset(f, -1, sizeof(f));
  S--;
  for (int i = 0; i < (int)(N); ++i)
    if (a[i] == 0) {
      f[0][0][i] = min(distl(S, i), distr(S, i));
      prv[0][0][i] = -1;
    }
  for (int i = 0; i < (int)(ver.size()); ++i) {
    for (int j = 0; j < (int)(N); ++j)
      if (f[0][i][j] != -1) {
        if (cnt[i] == 1)
          update(1, i, j, 0, i, j, 0);
        else if (cnt[i] == 2) {
          update(1, i, l[j][i], 0, i, j, distl(j, l[j][i]));
          update(1, i, r[j][i], 0, i, j, distr(j, r[j][i]));
        } else {
          update(1, i, l[j][i], 0, i, j, N - distl(j, l[j][i]));
          update(1, i, r[j][i], 0, i, j, N - distr(j, r[j][i]));
        }
      }
    if (i == ver.size() - 1) continue;
    for (int j = 0; j < (int)(N); ++j)
      if (f[1][i][j] != -1) {
        update(0, i + 1, l[j][i + 1], 1, i, j, distl(j, l[j][i + 1]));
        update(0, i + 1, r[j][i + 1], 1, i, j, distr(j, r[j][i + 1]));
      }
  }
  int bestId = -1, best = INF;
  for (int i = 0; i < (int)(N); ++i)
    if (a[i] == ver.size() - 1) {
      if (best > f[1][a[i]][i] && f[1][a[i]][i] != -1) {
        best = f[1][a[i]][i];
        bestId = i;
      }
    }
  printf("%d\n", best);
  int siz = ver.size();
  ver.clear();
  path(1, siz - 1, bestId);
  for (int i = 0; i < (int)(ver.size()); ++i) {
    if (cnt[i / 2] == 1)
      ret.push_back(ver[i]);
    else if (cnt[i / 2] == 2)
      ret.push_back(ver[i]), ret.push_back(ver[i + 1]);
    else {
      if (f[0][i / 2][ver[i]] + N - distl(ver[i], ver[i + 1]) ==
          f[1][i / 2][ver[i + 1]]) {
        ret.push_back(ver[i]);
        for (int j = ver[i] + 1; j != ver[i]; ++j) {
          if (j >= N) j -= N;
          if (j == ver[i]) break;
          if (a[j] == i / 2) ret.push_back(j);
        }
      } else {
        ret.push_back(ver[i]);
        for (int j = ver[i] - 1; j != ver[i]; --j) {
          if (j < 0) j += N;
          if (j == ver[i]) break;
          if (a[j] == i / 2) ret.push_back(j);
        }
      }
    }
    i++;
  }
  int pos = S;
  for (int i = 0; i < (int)(ret.size()); ++i) {
    if (distl(pos, ret[i]) < distr(pos, ret[i]))
      printf("-%d\n", distl(pos, ret[i]));
    else
      printf("+%d\n", distr(pos, ret[i]));
    pos = ret[i];
  }
  return 0;
}
