#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ld eps = 1e-8;
template <class U, class V>
ostream& operator<<(ostream& out, const pair<U, V>& p) {
  return out << "(" << p.first << ", " << p.second << ")";
}
template <size_t i, class T>
ostream& print_tuple_utils(ostream& out, const T& tup) {
  if constexpr (i == tuple_size<T>::value)
    return out << ")";
  else
    return print_tuple_utils<i + 1, T>(out << (i ? ", " : "(") << get<i>(tup),
                                       tup);
}
template <class... U>
ostream& operator<<(ostream& out, const tuple<U...>& tup) {
  return print_tuple_utils<0, tuple<U...>>(out, tup);
}
template <class Con, class = decltype(begin(declval<Con>()))>
typename enable_if<!is_same<Con, string>::value, ostream&>::type operator<<(
    ostream& out, const Con& container) {
  out << "{";
  for (auto it = container.begin(); it != container.end(); ++it)
    out << (it == container.begin() ? "" : ", ") << *it;
  return out << "}";
}
const int maxn = 2222;
int n, s;
int a[maxn];
map<int, vector<int>> pos;
int forw_dist(int from, int to) {
  int ans = to - from;
  if (ans < 0) ans += n;
  return ans;
}
inline int back_dist(int from, int to) { return forw_dist(to, from); }
int dist(int from, int to) {
  return min(forw_dist(from, to), back_dist(from, to));
}
int rel_dist(int from, int to) {
  auto fd = forw_dist(from, to);
  auto bd = back_dist(from, to);
  if (fd < bd) return fd;
  return -bd;
}
vector<int>::const_iterator find_next(const vector<int>& p, int val) {
  auto it = upper_bound((p).begin(), (p).end(), val);
  if (it == p.end()) return p.begin();
  return it;
}
vector<int>::const_iterator find_prev(const vector<int>& p, int val) {
  auto it = lower_bound((p).begin(), (p).end(), val);
  if (it == p.begin()) return --p.end();
  return --it;
}
function<int(int, int)> cal_ans[] = {
    [](int start, int stop) {
      auto& stop_pos = pos[a[stop]];
      auto target = find_prev(stop_pos, start);
      return forw_dist(start, *target) + dist(*target, stop);
    },
    [](int start, int stop) {
      auto& stop_pos = pos[a[stop]];
      auto target = find_next(stop_pos, start);
      return back_dist(start, *target) + dist(*target, stop);
    },
    [](int start, int stop) {
      auto& stop_pos = pos[a[stop]];
      auto target = find_prev(stop_pos, stop);
      return forw_dist(start, *target) + back_dist(*target, stop);
    },
    [](int start, int stop) {
      auto& stop_pos = pos[a[stop]];
      auto target = find_next(stop_pos, stop);
      return back_dist(start, *target) + forw_dist(*target, stop);
    },
};
function<list<int>(int, int)> get_ans[] = {
    [](int start, int stop) -> list<int> {
      list<int> ans;
      auto target = find_prev(pos[a[stop]], start);
      int prev_pos = start;
      for (int i = start; i != *target; i = (i + 1) % n) {
        if (a[i] != a[stop]) continue;
        if (i == stop) continue;
        ans.push_back(forw_dist(prev_pos, i));
        prev_pos = i;
      }
      ans.push_back(forw_dist(prev_pos, *target));
      auto last = rel_dist(*target, stop);
      if (last) ans.push_back(last);
      return ans;
    },
    [](int start, int stop) -> list<int> {
      list<int> ans;
      auto target = find_next(pos[a[stop]], start);
      int prev_pos = start;
      for (int i = start; i != *target; i = (i - 1 + n) % n) {
        if (a[i] != a[stop]) continue;
        if (i == stop) continue;
        ans.push_back(-back_dist(prev_pos, i));
        prev_pos = i;
      }
      ans.push_back(-back_dist(prev_pos, *target));
      auto last = rel_dist(*target, stop);
      if (last) ans.push_back(last);
      return ans;
    },
    [](int start, int stop) -> list<int> {
      list<int> ans;
      auto target = find_prev(pos[a[stop]], stop);
      int prev_pos = start;
      for (int i = start; i != *target; i = (i + 1) % n) {
        if (a[i] != a[stop]) continue;
        if (i == stop) continue;
        ans.push_back(forw_dist(prev_pos, i));
        prev_pos = i;
      }
      ans.push_back(forw_dist(prev_pos, *target));
      prev_pos = *target;
      for (int i = (start - 1 + n) % n; i != stop; i = (i - 1 + n) % n) {
        if (a[i] != a[stop]) continue;
        ans.push_back(-back_dist(prev_pos, i));
        prev_pos = i;
      }
      auto last = rel_dist(prev_pos, stop);
      if (last) ans.push_back(last);
      return ans;
    },
    [](int start, int stop) -> list<int> {
      list<int> ans;
      auto target = find_next(pos[a[stop]], stop);
      int prev_pos = start;
      for (int i = start; i != *target; i = (i - 1 + n) % n) {
        if (a[i] != a[stop]) continue;
        if (i == stop) continue;
        ans.push_back(-back_dist(prev_pos, i));
        prev_pos = i;
      }
      ans.push_back(-back_dist(prev_pos, *target));
      prev_pos = *target;
      for (int i = (start + 1) % n; i != stop; i = (i + 1) % n) {
        if (a[i] != a[stop]) continue;
        ans.push_back(forw_dist(prev_pos, i));
        prev_pos = i;
      }
      auto last = rel_dist(prev_pos, stop);
      if (last) ans.push_back(last);
      return ans;
    },
};
tuple<int, int, int> dp[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  --s;
  for (int i = (int)(0); i < (int)(n); ++i) {
    cin >> a[i];
    pos[a[i]].push_back(i);
  }
  for (int i = (int)(0); i < (int)(n); ++i) {
    dp[i] = {INT_MAX, 0, 0};
  }
  for (auto u : pos.begin()->second) {
    for (int strat = (int)(0); strat < (int)(4); ++strat) {
      dp[u] = min(dp[u], {cal_ans[strat](s, u), -s - 1, strat});
    }
    if (0)
      cerr << "["
              "u"
              " = "
           << (u) << "] "
           << "["
              "dp[u]"
              " = "
           << (dp[u]) << "] " << endl;
  }
  vector<int>* prev_pos;
  for (auto& it : pos) {
    if (it.first == pos.begin()->first) {
      prev_pos = &it.second;
      continue;
    };
    if (0)
      cerr << "["
              "it.first"
              " = "
           << (it.first) << "] " << endl;
    if (0)
      cerr << "["
              "it.second"
              " = "
           << (it.second) << "] " << endl;
    if (0)
      cerr << "["
              "*prev_pos"
              " = "
           << (*prev_pos) << "] " << endl;
    for (auto stop : it.second) {
      for (auto start : *prev_pos) {
        for (int strat = (int)(0); strat < (int)(4); ++strat) {
          auto cur_ans = cal_ans[strat](start, stop) + get<0>(dp[start]);
          dp[stop] = min(dp[stop], {cur_ans, start, strat});
        }
      }
      if (0)
        cerr << "["
                "stop"
                " = "
             << (stop) << "] "
             << "["
                "dp[stop]"
                " = "
             << (dp[stop]) << "] " << endl;
    }
    prev_pos = &it.second;
  }
  pair<tuple<int, int, int>, int> ans = {{INT_MAX, 0, 0}, 0};
  for (int i = (int)(0); i < (int)(n); ++i)
    if (a[i] == pos.rbegin()->first) ans = min(ans, {dp[i], i});
  cout << get<0>(ans.first) << '\n';
  list<int> ans_list;
  for (int u = ans.second; u >= 0; u = get<1>(dp[u])) {
    int v = get<1>(dp[u]);
    if (v < 0) v = s;
    int strat = get<2>(dp[u]);
    auto cur_ans_list = get_ans[strat](v, u);
    ans_list.splice(ans_list.begin(), cur_ans_list);
  }
  for (auto i : ans_list) {
    if (i >= 0) cout << '+';
    cout << i << '\n';
  }
  return 0;
}

### Prompt

In Cpp, your task is to solve the following problem:

You are given a circular array with n elements. The elements are numbered from some element with values from 1 to n in clockwise order. The i-th cell contains the value ai. The robot Simba is in cell s.

Each moment of time the robot is in some of the n cells (at the begin he is in s). In one turn the robot can write out the number written in current cell or move to the adjacent cell in clockwise or counterclockwise direction. To write out the number from the cell Simba doesn't spend any time, but to move to adjacent cell Simba spends one unit of time.

Simba wants to write the number from each cell one time, so the numbers will be written in a non decreasing order. Find the least number of time units to write out all numbers.

Input

The first line contains two integers n and s (1 ≤ s ≤ n ≤ 2000) — the number of cells in the circular array and the starting position of Simba.

The second line contains n integers ai ( - 109 ≤ ai ≤ 109) — the number written in the i-th cell. The numbers are given for cells in order from 1 to n. Some of numbers ai can be equal.

Output

In the first line print the number t — the least number of time units.

Each of the next n lines should contain the direction of robot movement and the number of cells to move in that direction. After that movement the robot writes out the number from the cell in which it turns out. The direction and the number of cells should be printed in the form of +x in case of clockwise movement and -x in case of counterclockwise movement to x cells (0 ≤ x ≤ n - 1).

Note that the sum of absolute values of x should be equal to t.

Examples

Input

9 1
0 1 2 2 2 1 0 1 1


Output

12
+0
-3
-1
+2
+1
+2
+1
+1
+1


Input

8 1
0 1 0 1 0 1 0 1


Output

13
+0
+2
+2
+2
-1
+2
+2
+2


Input

8 1
1 2 3 4 5 6 7 8


Output

7
+0
+1
+1
+1
+1
+1
+1
+1


Input

8 1
0 0 0 0 0 0 0 0


Output

7
+0
+1
+1
+1
+1
+1
+1
+1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ld eps = 1e-8;
template <class U, class V>
ostream& operator<<(ostream& out, const pair<U, V>& p) {
  return out << "(" << p.first << ", " << p.second << ")";
}
template <size_t i, class T>
ostream& print_tuple_utils(ostream& out, const T& tup) {
  if constexpr (i == tuple_size<T>::value)
    return out << ")";
  else
    return print_tuple_utils<i + 1, T>(out << (i ? ", " : "(") << get<i>(tup),
                                       tup);
}
template <class... U>
ostream& operator<<(ostream& out, const tuple<U...>& tup) {
  return print_tuple_utils<0, tuple<U...>>(out, tup);
}
template <class Con, class = decltype(begin(declval<Con>()))>
typename enable_if<!is_same<Con, string>::value, ostream&>::type operator<<(
    ostream& out, const Con& container) {
  out << "{";
  for (auto it = container.begin(); it != container.end(); ++it)
    out << (it == container.begin() ? "" : ", ") << *it;
  return out << "}";
}
const int maxn = 2222;
int n, s;
int a[maxn];
map<int, vector<int>> pos;
int forw_dist(int from, int to) {
  int ans = to - from;
  if (ans < 0) ans += n;
  return ans;
}
inline int back_dist(int from, int to) { return forw_dist(to, from); }
int dist(int from, int to) {
  return min(forw_dist(from, to), back_dist(from, to));
}
int rel_dist(int from, int to) {
  auto fd = forw_dist(from, to);
  auto bd = back_dist(from, to);
  if (fd < bd) return fd;
  return -bd;
}
vector<int>::const_iterator find_next(const vector<int>& p, int val) {
  auto it = upper_bound((p).begin(), (p).end(), val);
  if (it == p.end()) return p.begin();
  return it;
}
vector<int>::const_iterator find_prev(const vector<int>& p, int val) {
  auto it = lower_bound((p).begin(), (p).end(), val);
  if (it == p.begin()) return --p.end();
  return --it;
}
function<int(int, int)> cal_ans[] = {
    [](int start, int stop) {
      auto& stop_pos = pos[a[stop]];
      auto target = find_prev(stop_pos, start);
      return forw_dist(start, *target) + dist(*target, stop);
    },
    [](int start, int stop) {
      auto& stop_pos = pos[a[stop]];
      auto target = find_next(stop_pos, start);
      return back_dist(start, *target) + dist(*target, stop);
    },
    [](int start, int stop) {
      auto& stop_pos = pos[a[stop]];
      auto target = find_prev(stop_pos, stop);
      return forw_dist(start, *target) + back_dist(*target, stop);
    },
    [](int start, int stop) {
      auto& stop_pos = pos[a[stop]];
      auto target = find_next(stop_pos, stop);
      return back_dist(start, *target) + forw_dist(*target, stop);
    },
};
function<list<int>(int, int)> get_ans[] = {
    [](int start, int stop) -> list<int> {
      list<int> ans;
      auto target = find_prev(pos[a[stop]], start);
      int prev_pos = start;
      for (int i = start; i != *target; i = (i + 1) % n) {
        if (a[i] != a[stop]) continue;
        if (i == stop) continue;
        ans.push_back(forw_dist(prev_pos, i));
        prev_pos = i;
      }
      ans.push_back(forw_dist(prev_pos, *target));
      auto last = rel_dist(*target, stop);
      if (last) ans.push_back(last);
      return ans;
    },
    [](int start, int stop) -> list<int> {
      list<int> ans;
      auto target = find_next(pos[a[stop]], start);
      int prev_pos = start;
      for (int i = start; i != *target; i = (i - 1 + n) % n) {
        if (a[i] != a[stop]) continue;
        if (i == stop) continue;
        ans.push_back(-back_dist(prev_pos, i));
        prev_pos = i;
      }
      ans.push_back(-back_dist(prev_pos, *target));
      auto last = rel_dist(*target, stop);
      if (last) ans.push_back(last);
      return ans;
    },
    [](int start, int stop) -> list<int> {
      list<int> ans;
      auto target = find_prev(pos[a[stop]], stop);
      int prev_pos = start;
      for (int i = start; i != *target; i = (i + 1) % n) {
        if (a[i] != a[stop]) continue;
        if (i == stop) continue;
        ans.push_back(forw_dist(prev_pos, i));
        prev_pos = i;
      }
      ans.push_back(forw_dist(prev_pos, *target));
      prev_pos = *target;
      for (int i = (start - 1 + n) % n; i != stop; i = (i - 1 + n) % n) {
        if (a[i] != a[stop]) continue;
        ans.push_back(-back_dist(prev_pos, i));
        prev_pos = i;
      }
      auto last = rel_dist(prev_pos, stop);
      if (last) ans.push_back(last);
      return ans;
    },
    [](int start, int stop) -> list<int> {
      list<int> ans;
      auto target = find_next(pos[a[stop]], stop);
      int prev_pos = start;
      for (int i = start; i != *target; i = (i - 1 + n) % n) {
        if (a[i] != a[stop]) continue;
        if (i == stop) continue;
        ans.push_back(-back_dist(prev_pos, i));
        prev_pos = i;
      }
      ans.push_back(-back_dist(prev_pos, *target));
      prev_pos = *target;
      for (int i = (start + 1) % n; i != stop; i = (i + 1) % n) {
        if (a[i] != a[stop]) continue;
        ans.push_back(forw_dist(prev_pos, i));
        prev_pos = i;
      }
      auto last = rel_dist(prev_pos, stop);
      if (last) ans.push_back(last);
      return ans;
    },
};
tuple<int, int, int> dp[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  --s;
  for (int i = (int)(0); i < (int)(n); ++i) {
    cin >> a[i];
    pos[a[i]].push_back(i);
  }
  for (int i = (int)(0); i < (int)(n); ++i) {
    dp[i] = {INT_MAX, 0, 0};
  }
  for (auto u : pos.begin()->second) {
    for (int strat = (int)(0); strat < (int)(4); ++strat) {
      dp[u] = min(dp[u], {cal_ans[strat](s, u), -s - 1, strat});
    }
    if (0)
      cerr << "["
              "u"
              " = "
           << (u) << "] "
           << "["
              "dp[u]"
              " = "
           << (dp[u]) << "] " << endl;
  }
  vector<int>* prev_pos;
  for (auto& it : pos) {
    if (it.first == pos.begin()->first) {
      prev_pos = &it.second;
      continue;
    };
    if (0)
      cerr << "["
              "it.first"
              " = "
           << (it.first) << "] " << endl;
    if (0)
      cerr << "["
              "it.second"
              " = "
           << (it.second) << "] " << endl;
    if (0)
      cerr << "["
              "*prev_pos"
              " = "
           << (*prev_pos) << "] " << endl;
    for (auto stop : it.second) {
      for (auto start : *prev_pos) {
        for (int strat = (int)(0); strat < (int)(4); ++strat) {
          auto cur_ans = cal_ans[strat](start, stop) + get<0>(dp[start]);
          dp[stop] = min(dp[stop], {cur_ans, start, strat});
        }
      }
      if (0)
        cerr << "["
                "stop"
                " = "
             << (stop) << "] "
             << "["
                "dp[stop]"
                " = "
             << (dp[stop]) << "] " << endl;
    }
    prev_pos = &it.second;
  }
  pair<tuple<int, int, int>, int> ans = {{INT_MAX, 0, 0}, 0};
  for (int i = (int)(0); i < (int)(n); ++i)
    if (a[i] == pos.rbegin()->first) ans = min(ans, {dp[i], i});
  cout << get<0>(ans.first) << '\n';
  list<int> ans_list;
  for (int u = ans.second; u >= 0; u = get<1>(dp[u])) {
    int v = get<1>(dp[u]);
    if (v < 0) v = s;
    int strat = get<2>(dp[u]);
    auto cur_ans_list = get_ans[strat](v, u);
    ans_list.splice(ans_list.begin(), cur_ans_list);
  }
  for (auto i : ans_list) {
    if (i >= 0) cout << '+';
    cout << i << '\n';
  }
  return 0;
}

```