#include <bits/stdc++.h>
using namespace std;
int const MAX_N = 2100;
int const MAX_CH = 500100;
long long const LL_INF = 1000000000000000000LL;
int const INT_INF = 1000000000;
int n, MAX_NUM;
int s[MAX_N];
int all_p[MAX_N][MAX_N], all_p_len[MAX_N];
int def_lay_pos[MAX_N];
int dp[MAX_N][MAX_N];
int from_dir_1[MAX_N][MAX_N], from_dir_2[MAX_N][MAX_N],
    from_in_index[MAX_N][MAX_N], from_out_index[MAX_N][MAX_N];
set<int> ms;
map<int, int> remap;
char buf[1000];
struct pp {
  int sum;
  vector<string> p;
} ans;
void add_st(vector<string> &s, int dr, int cnt) {
  if (dr > 0)
    sprintf(buf, "+%d", cnt);
  else
    sprintf(buf, "-%d", cnt);
  s.push_back(buf);
}
pp get_ans(int ind) {
  pp ans;
  ans.sum = INT_INF;
  ans.p.clear();
  for (int i = 0; i <= MAX_NUM; i++) all_p_len[i] = 0;
  for (int i = 0; i <= MAX_NUM; i++)
    for (int j = 0; j < n; j++)
      if (s[j] == i) {
        def_lay_pos[j] = all_p_len[i];
        all_p[i][all_p_len[i]++] = j;
      }
  for (int i = 0; i <= MAX_NUM; i++)
    for (int j = 0; j < all_p_len[i]; j++) {
      dp[i][j] = INT_INF;
      from_dir_1[i][j] = -1;
      from_dir_2[i][j] = -1;
      from_out_index[i][j] = -1;
      from_in_index[i][j] = -1;
    }
  for (int dir = -1; dir <= 1; dir += 2) {
    int x = ind;
    int cnt = 0;
    while (1) {
      if (s[x] == 0)
        if (cnt < dp[s[x]][def_lay_pos[x]]) {
          dp[s[x]][def_lay_pos[x]] = cnt;
          from_dir_1[s[x]][def_lay_pos[x]] = dir;
          from_dir_2[s[x]][def_lay_pos[x]] = dir;
          from_out_index[s[x]][def_lay_pos[x]] = ind;
          from_in_index[s[x]][def_lay_pos[x]] = ind;
        }
      x += dir;
      if (x < 0) x = n - 1;
      if (x >= n) x = 0;
      cnt++;
      if (x == ind) break;
    }
  }
  int best_cost = INT_INF, ans_lay = -1, ans_new_dir = -3, ans_dir = -3,
      ans_out_index = -1, ans_in_index = -1;
  for (int lay = 0; lay <= MAX_NUM; lay++)
    for (int i = 0; i < all_p_len[lay]; i++)
      if (dp[lay][i] < INT_INF) {
        int bg_lay = i;
        for (int dir = -1; dir <= 1; dir += 2) {
          int p = bg_lay;
          int cost = dp[lay][i];
          int prev_p = p - dir;
          if (prev_p < 0) prev_p = all_p_len[lay] - 1;
          if (prev_p >= all_p_len[lay]) prev_p = 0;
          int go_to_index = all_p[lay][prev_p];
          p = all_p[lay][p];
          while (p != go_to_index) {
            p += dir;
            cost++;
            if (p < 0) p = n - 1;
            if (p >= n) p = 0;
          }
          if (lay == MAX_NUM) {
            if (cost < best_cost) {
              best_cost = cost;
              ans_lay = lay;
              ans_dir = dir;
              ans_out_index = p;
              ans_in_index = all_p[lay][bg_lay];
            }
            continue;
          }
          for (int new_dir = -1; new_dir <= 1; new_dir += 2) {
            int new_v = p;
            int loc_cost = cost;
            while (s[new_v] != lay + 1) {
              new_v += new_dir;
              if (new_v < 0) new_v = n - 1;
              if (new_v >= n) new_v = 0;
              loc_cost++;
            }
            if (loc_cost < dp[lay + 1][def_lay_pos[new_v]]) {
              dp[lay + 1][def_lay_pos[new_v]] = loc_cost;
              from_dir_1[lay + 1][def_lay_pos[new_v]] = dir;
              from_dir_2[lay + 1][def_lay_pos[new_v]] = new_dir;
              from_out_index[lay + 1][def_lay_pos[new_v]] = p;
              from_in_index[lay + 1][def_lay_pos[new_v]] = all_p[lay][bg_lay];
            }
          }
        }
      }
  ans.sum = best_cost;
  vector<string> to_prt;
  to_prt.clear();
  int p = ans_out_index;
  while (ans_lay >= -1) {
    if (ans_lay < MAX_NUM) {
      int cnt = 0;
      while (p != ans_out_index) {
        p -= ans_new_dir;
        if (p < 0) p = n - 1;
        if (p >= n) p = 0;
        cnt++;
      }
      add_st(to_prt, ans_new_dir, cnt);
    }
    if (ans_lay < 0) break;
    int cnt = 0;
    while (p != ans_in_index) {
      p -= ans_dir;
      if (p < 0) p = n - 1;
      if (p >= n) p = 0;
      cnt++;
      if (s[p] == ans_lay) {
        add_st(to_prt, ans_dir, cnt);
        cnt = 0;
      }
    }
    int NEW_ans_lay = ans_lay - 1;
    int NEW_ans_dir = from_dir_1[ans_lay][def_lay_pos[ans_in_index]];
    int NEW_ans_new_dir = from_dir_2[ans_lay][def_lay_pos[ans_in_index]];
    int NEW_ans_out_index = from_out_index[ans_lay][def_lay_pos[ans_in_index]];
    int NEW_ans_in_index = from_in_index[ans_lay][def_lay_pos[ans_in_index]];
    ans_lay = NEW_ans_lay;
    ans_dir = NEW_ans_dir;
    ans_new_dir = NEW_ans_new_dir;
    ans_out_index = NEW_ans_out_index;
    ans_in_index = NEW_ans_in_index;
  }
  ans.p.clear();
  for (int i = ((int)to_prt.size()) - 1; i >= 0; i--)
    ans.p.push_back(to_prt[i]);
  return ans;
}
int main() {
  int a;
  scanf("%d%d", &n, &a);
  a--;
  for (int i = 0; i < n; i++) {
    scanf("%d", &s[i]);
    ms.insert(s[i]);
  }
  int ind = 0;
  for (set<int>::iterator iter = ms.begin(); iter != ms.end(); ++iter)
    remap[*iter] = ind++;
  for (int i = 0; i < n; i++) s[i] = remap[s[i]];
  MAX_NUM = ind - 1;
  ans = get_ans(a);
  printf("%d", ans.sum);
  for (int i = 0; i < (int)ans.p.size(); i++) printf("\n%s", ans.p[i].c_str());
  return 0;
}
