#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int n, s, a[2010], pre[2010], nxt[2010], b[2010], k, f[2010][2];
vector<int> v[2010];
pair<int, int> from[2010][2];
int dis(int first, int second) {
  int res = abs(first - second);
  res = min(res, n - res);
  return res;
}
int get(int i, int j, int t, int first, int second,
        vector<pair<int, int> > &g) {
  int cnt = 0, res = 0, now = 0;
  g.clear();
  while (true) {
    if (a[i] == first || i == j) {
      if (a[i] == first) {
        cnt++;
      }
      g.push_back(make_pair(now, t));
      now = 0;
    }
    if (i == j) {
      break;
    }
    res++;
    now++;
    i += t;
    if (i < 0) {
      i += n;
    }
    if (i >= n) {
      i -= n;
    }
  }
  if (cnt < second) {
    return inf;
  } else {
    return res;
  }
}
int main() {
  scanf("%d%d", &n, &s);
  s--;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    b[++k] = a[i];
  }
  sort(b + 1, b + k + 1);
  k = unique(b + 1, b + k + 1) - b - 1;
  for (int i = 0; i < n; i++) {
    a[i] = lower_bound(b + 1, b + k + 1, a[i]) - b;
    v[a[i]].push_back(i);
  }
  for (int i = 1; i <= k; i++) {
    int sz = v[i].size();
    for (int j = 0; j < sz; j++) {
      pre[v[i][j]] = v[i][(j + sz - 1) % sz];
      nxt[v[i][j]] = v[i][(j + 1) % sz];
    }
  }
  for (int i = 0; i < n; i++) {
    f[i][0] = f[i][1] = inf;
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 1) {
      f[i][0] = dis(s, i);
    }
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 0; j < v[i].size(); j++) {
      int first = v[i][j];
      int l = pre[first];
      int r = nxt[first];
      if (l == first) {
        if (f[first][0] < f[first][1]) {
          f[first][1] = f[first][0];
          from[first][1] = make_pair(first, 0);
        }
      }
      int dl, dr;
      if (l < first) {
        dl = first - l;
      } else {
        dl = first + n - l;
      }
      if (r > first) {
        dr = r - first;
      } else {
        dr = r + n - first;
      }
      if (f[l][1] > f[first][0] + (n - dl)) {
        f[l][1] = f[first][0] + (n - dl);
        from[l][1] = make_pair(first, 0);
      }
      if (f[r][1] > f[first][0] + (n - dr)) {
        f[r][1] = f[first][0] + (n - dr);
        from[r][1] = make_pair(first, 0);
      }
    }
    for (int j = 0; j < v[i].size(); j++) {
      int first = v[i][j];
      for (int k = 0; k < v[i + 1].size(); k++) {
        int second = v[i + 1][k];
        int d = dis(first, second);
        if (f[second][0] > f[first][1] + d) {
          f[second][0] = f[first][1] + d;
          from[second][0] = make_pair(first, 1);
        }
      }
    }
  }
  int ans = inf, qi, qj;
  vector<pair<int, int> > g;
  for (int i = 0; i < n; i++) {
    if (a[i] == k) {
      if (f[i][1] < ans) {
        ans = f[i][1];
        qi = i;
        qj = 1;
      }
    }
  }
  printf("%d\n", ans);
  while (a[qi] > 1 || qj) {
    pair<int, int> u = from[qi][qj];
    int first, second;
    if (!qj && u.second) {
      first = 0;
      second = 0;
    } else {
      first = a[qi];
      second = v[a[qi]].size();
    }
    vector<pair<int, int> > v1, v2;
    int c1 = get(u.first, qi, 1, first, second, v1);
    int c2 = get(u.first, qi, -1, first, second, v2);
    reverse(v1.begin(), v1.end());
    reverse(v2.begin(), v2.end());
    if (c1 < c2) {
      for (int i = 0; i < v1.size(); i++) {
        g.push_back(v1[i]);
      }
    } else {
      for (int i = 0; i < v2.size(); i++) {
        g.push_back(v2[i]);
      }
    }
    qi = u.first;
    qj = u.second;
  }
  int first = 0, second = 0;
  vector<pair<int, int> > v1, v2;
  int c1 = get(s, qi, 1, first, second, v1);
  int c2 = get(s, qi, -1, first, second, v2);
  reverse(v1.begin(), v1.end());
  reverse(v2.begin(), v2.end());
  if (c1 < c2) {
    for (int i = 0; i < v1.size(); i++) {
      g.push_back(v1[i]);
    }
  } else {
    for (int i = 0; i < v2.size(); i++) {
      g.push_back(v2[i]);
    }
  }
  reverse(g.begin(), g.end());
  for (int i = 0; i < g.size(); i++) {
    if (i && !g[i].first) {
      continue;
    }
    if (g[i].second == 1) {
      putchar('+');
    } else {
      putchar('-');
    }
    printf("%d\n", g[i].first);
  }
  return 0;
}
