709_B. Checkpoints
Vasya takes part in the orienteering competition. There are n checkpoints located along the line at coordinates x1, x2, ..., xn. Vasya starts at the point with coordinate a. His goal is to visit at least n - 1 checkpoint in order to finish the competition. Participant are allowed to visit checkpoints in arbitrary order.

Vasya wants to pick such checkpoints and the order of visiting them that the total distance travelled is minimized. He asks you to calculate this minimum possible value.

Input

The first line of the input contains two integers n and a (1 ≤ n ≤ 100 000,  - 1 000 000 ≤ a ≤ 1 000 000) — the number of checkpoints and Vasya's starting position respectively.

The second line contains n integers x1, x2, ..., xn ( - 1 000 000 ≤ xi ≤ 1 000 000) — coordinates of the checkpoints.

Output

Print one integer — the minimum distance Vasya has to travel in order to visit at least n - 1 checkpoint.

Examples

Input

3 10
1 7 12


Output

7


Input

2 0
11 -10


Output

10


Input

5 0
0 0 1000 0 0


Output

0

Note

In the first sample Vasya has to visit at least two checkpoints. The optimal way to achieve this is the walk to the third checkpoints (distance is 12 - 10 = 2) and then proceed to the second one (distance is 12 - 7 = 5). The total distance is equal to 2 + 5 = 7.

In the second sample it's enough to visit only one checkpoint so Vasya should just walk to the point  - 10.
```python
n, a = map(int, input().split())
x = list(map(int, input().split()))

if n == 1:
    print(0)
elif n == 2:
    if abs(x[0]-a) < abs(x[1]-a):
        print(abs(x[0]-a))
    else:
        print(abs(x[1]-a))
elif n == 3:
    x = sorted(x)
    _min = x[0]
    _mid = x[1]
    _max = x[2]
    ans = abs(_max - a)*2 + abs(_mid - a)
    if abs(_max - a) + abs(_mid - a)*2 < ans:
        ans = abs(_max - a) + abs(_mid - a)*2
    if abs(_min - a)*2 + abs(_mid - a) < ans:
        ans = abs(_min - a)*2 + abs(_mid - a)
    if abs(_min - a) + abs(_mid - a)*2 < ans:
        ans = abs(_min - a) + abs(_mid - a)*2
    print(ans)
else:
    _max = -10**6 + 1
    _nmax = -10**6 + 1
    _min = 10**6 + 1
    _nmin = 10**6 + 1
    for i in range(n):
        if x[i] >= _max:
            _nmax = _max
            _max = x[i]
        elif x[i] > _nmax:
            _nmax = x[i]
        if x[i] <= _min:
            _nmin = _min
            _min = x[i]
        elif x[i] < _nmin:
            _nmin = x[i]
    if _nmax > a > _nmin:
        ans = abs(_max-a)*2 + abs(_nmin-a)
        if abs(_max-a) + abs(_nmin-a)*2 < ans:
            ans = abs(_max-a) + abs(_nmin-a)*2
        if abs(_nmax-a)*2 + abs(_min-a) < ans:
            ans = abs(_nmax-a)*2 + abs(_min-a)
        if abs(_nmax-a) + abs(_min-a)*2 < ans:
            ans = abs(_nmax-a) + abs(_min-a)*2
        print(ans)
    elif _max > a >= _nmax:
        ans = abs(_max-a)*2 + abs(_nmin-a)
        if abs(_min-a) < ans:
            ans = abs(_min-a)
        if abs(_nmin-a)*2 + abs(_max-a) < ans:
            ans = abs(_nmin-a)*2 + abs(_max-a)
        print(ans)
    elif a >= _max:
        print(abs(a-_nmin))
    elif a <= _min:
        print(abs(a-_nmax))
    else:
        ans = abs(_min-a)*2 + abs(_nmax-a)
        if abs(_max-a) < ans:
            ans = abs(_max-a)
        if abs(_nmax-a)*2 + abs(_min-a) < ans:
            ans = abs(_nmax-a)*2 + abs(_min-a)
        print(ans)
```