#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
const int N = 2005;
int INF = INT_MAX / 3;
int n;
int a[N];
int dpin[N];
int dpout[N];
int into[N];
int outto[N];
bool cwin[N];
bool cwout[N];
map<int, int> npos;
int solveout(int pos);
int dist(int aa, int bb) {
  int mdist = abs(aa - bb);
  return min(mdist, n - mdist);
}
int solvein(int pos) {
  if (dpin[pos] != -1) return dpin[pos];
  int next = (pos + 1) % n, nsteps = 1;
  while (a[next] != a[pos]) {
    next++;
    if (next >= n) next -= n;
    nsteps++;
  }
  if (next == pos) {
    into[pos] = pos;
    return solveout(pos);
  }
  int prev = (pos - 1 + n) % n, psteps = 1;
  while (a[prev] != a[pos]) {
    prev--;
    if (prev < 0) prev += n;
    psteps++;
  }
  int opt1 = solveout(next) + n - nsteps;
  int opt2 = solveout(prev) + n - psteps;
  if (opt1 < opt2) {
    into[pos] = next;
    cwin[pos] = false;
    return opt1;
  } else {
    into[pos] = prev;
    cwin[pos] = true;
    return opt2;
  }
}
inline bool iscw(int pos, int end) {
  int r = pos + dist(pos, end);
  if (r >= n) r -= n;
  return r == end;
}
int find_next(int pos) { return npos[a[pos]]; }
int solveout(int pos) {
  if (dpout[pos] != -1) return dpout[pos];
  int next = find_next(pos);
  if (next == -INF) {
    outto[pos] = -1;
    return 0;
  }
  int best = INF, bestidx = -1;
  for (int i = 0; i < n; i++) {
    if (a[i] == next) {
      int ans = solvein(i) + dist(pos, i);
      if (ans < best) {
        best = ans;
        bestidx = i;
      }
    }
  }
  assert(best != INF);
  cwout[pos] = iscw(pos, bestidx);
  outto[pos] = bestidx;
  return dpout[pos] = best;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int start;
  cin >> n >> start;
  start--;
  vector<int> opts;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    opts.push_back(a[i]);
  }
  sort(opts.begin(), opts.end());
  for (int i = 1; i < n; i++) {
    if (opts[i] != opts[i - 1]) {
      npos[opts[i - 1]] = opts[i];
    }
  }
  npos[opts[opts.size() - 1]] = -INF;
  int first = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] < a[first]) first = i;
  }
  fill_n(dpin, n, -1);
  fill_n(dpout, n, -1);
  int ans = INF, startidx = -1;
  for (int i = 0; i < n; i++) {
    if (a[i] == a[first]) {
      int curr = solvein(i) + dist(start, i);
      if (curr < ans) {
        ans = curr;
        startidx = i;
      }
    }
  }
  assert(ans != INF);
  cout << ans << '\n';
  if (iscw(start, startidx))
    cout << '+';
  else
    cout << '-';
  cout << dist(start, startidx) << '\n';
  int pos = startidx;
  while (true) {
    int end = into[pos];
    int ch = cwin[pos] ? 1 : -1;
    char d = cwin[pos] ? '+' : '-';
    int pp = pos;
    while (pos != end) {
      pos += ch;
      if (pos < 0) pos += n;
      if (pos >= n) pos -= n;
      if (a[pos] == a[end]) {
        cout << d << dist(pp, pos) << '\n';
        pp = pos;
      }
    }
    if (outto[pos] == -1) break;
    if (cwout[pos])
      cout << "+";
    else
      cout << "-";
    cout << dist(pos, outto[pos]) << '\n';
    pos = outto[pos];
  }
}
