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

Solution (in PYTHON):

Solution:
from heapq import heappush, heappop
from collections import defaultdict

def solve(start, lt):
    n = len(lt)
    ii = list(sorted(set(lt)))
    maxlt = max(ii)
    right = {}
    left = {}
    leftn = {}
    rightn = {}
    last = {}

    for i in range(2 * n):
        l = lt[i % n]
        if l in last:
            right[last[l]] = i % n
            left[i % n] = last[l]
        last[l] = i % n

    hole = defaultdict(lambda: - 10**10)
    _mindst = {}
    mindstb = {}
    mindste = {}
    for i in range(n):
        hole[lt[i]] = max(hole[lt[i]], (right[i] - i) % n)
    for i in range(n):
        _mindst[lt[i]] = n - hole[lt[i]]
    last = 0
    for i in reversed(ii):
        mindste[i] = last
        last += _mindst[i]
        mindstb[i] = last

    def np(state):
        pos, boe = state
        if boe == 'begin':
            if left[pos] == pos:
                yield (0, (pos, 'end'), (('>', pos),))
            l = pos
            while True:
                ll = left[l]
                if ll == pos:
                    break
                distance = 2 * ((pos - l) % n) + (ll - pos) % n
                path = (('<', l), ('>', ll))
                yield (distance, (ll, 'end'), path)
                l = left[l]
            r = pos
            while True:
                rr = right[r]
                if rr == pos:
                    break
                distance = 2 * ((r - pos) % n) + (pos - rr) % n
                path = (('>', r), ('<', rr))
                yield (distance, (rr, 'end'), path)
                r = right[r]
        if boe == 'end' or boe == 'start':
            if boe == 'start':
                nxtl = ii[0]
            else:
                nxtl = ii[ii.index(lt[pos]) + 1]
            p = pos
            while lt[p] != nxtl:
                p = (p + 1) % n
            yield ((p - pos) % n, (p, 'begin'), (('up', '>', p),))
            p = pos
            while lt[p] != nxtl:
                p = (p - 1) % n
            yield ((pos - p) % n, (p, 'begin'), (('up', '<', p),))

    def dijkstra(beg):
        border = []
        heappush(border, (mindstb[lt[beg[0]]], 0, beg, None, None))
        fin = {}
        while True:
            asd, verd, ver, parent, path = heappop(border)
            if ver not in fin:
                fin[ver] = verd, parent, path
                pos, boe = ver
                if boe == 'end' and lt[pos] == maxlt:
                    cur = ver
                    gpath = []
                    while cur != beg:
                        _, parent, path = fin[cur]
                        gpath.extend(reversed(path))
                        cur = parent
                    return verd, list(reversed(gpath))
                for d, neigh, path in np(ver):
                    pos, boe = neigh
                    if boe == 'start' or boe == 'begin':
                        asd = d + verd + mindstb[lt[pos]]
                    else:
                        asd = d + verd + mindste[lt[pos]]
                    heappush(border, (asd,(d + verd), neigh, ver, path))

    def reconstruct(path):
        cur = start
        res = []
        done = set()
        for ps in path:
            #print('ps', ps, 'cur', cur)
            if len(ps) == 3:
                _, direction, pos = ps
                dst = (pos - cur) % n if direction == '>' else (cur - pos) % n
                sign = '+' if dst == 0 or direction == '>' else '-'
                res.append('%s%d'%(sign, dst))
                cur = pos
                done.add(pos)
            else:
                direction, pos = ps
                if direction == '>':
                    last = cur
                    while cur != pos:
                        cur = right[cur]
                        if cur not in done:
                            done.add(cur)
                            res.append('+%d'%((cur-last)%n))
                            last = cur
                if direction == '<':
                    last = cur
                    while cur != pos:
                        cur = left[cur]
                        if cur not in done:
                            done.add(cur)
                            res.append('-%d'%((last-cur)%n))
                            last = cur
        return res

    dst, path = dijkstra((start, 'start'))
    return dst, reconstruct(path)

def check(start, lt, sol, dst):
    cmp_dst, path = sol
    ltcur = -10**10
    n = len(lt)
    assert(cmp_dst == dst)
    done = set()
    cur = start
    for move in path:
        cur += {'+': 1, '-': -1}[move[0]] * int(move[1:])
        cur %= n
        assert(cur not in done)
        done.add(cur)
        assert(lt[cur] >= ltcur)
        ltcur = lt[cur]
    assert(len(done) == len(lt))

n, start = tuple(map(int, raw_input().split()))
lt = tuple(map(int, raw_input().split()))
dst, rpath = solve(start - 1, lt)
print(dst)
for p in rpath:
    print(p)