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.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public class Solution {
	
//	public static final double eps = 1e-9;
//	public static final int mod = 1000000007;
//	public static final double pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679;
//	public static final int sievesize = (int) (1e6 + 10);
//	public static boolean[] prime;
//	public static final int dx[] = {1, -1, 0, 0};
//	public static final int dy[] = {0, 0, 1, -1};

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
	}
	
	static class Task {
		
        public void solve(int testNumber, InputReader in, OutputWriter out) { 
        	long n = in.nextLong(), a = in.nextLong();
        	long[] arr = in.nextLongArray((int) n);
        	if(n == 1) {
        		out.println("0");
        	}
        	else{
        		Arrays.sort(arr);
        		long sum1 = Math.abs(arr[0] - a) + Math.abs(arr[0] - arr[(int) (n - 2)]);
        		long sum2 = Math.abs(arr[(int) (n - 2)] - a) + Math.abs(arr[0] - arr[(int) (n - 2)]);
        		long sum3 = Math.abs(arr[1] - a) + Math.abs(arr[1] - arr[(int) (n - 1)]);
        		long sum4 = Math.abs(arr[(int) (n - 1)] - a) + Math.abs(arr[1] - arr[(int) (n - 1)]);
        		long ans = Math.min(sum1, sum2);
        		ans = Math.min(ans, sum3);
        		ans = Math.min(ans, sum4);
        		out.println(ans);
        	}	
        }
        
//        static class Node {
//        	LinkedList<Pair> list;
//        	boolean storage;
//        	
//        	public Node() {
//				list = new LinkedList<>();
//				storage = false;
//			}
//        }
        
//        static class Pair implements Comparable<Pair> {
//        	
//        	long first, second;
//        	
//        	public Pair(long first, long second) {
//        		this.first = first;
//				this.second = second;
//			}
//
//			@Override
//			public int compareTo(Pair o) {
//				return 0;
//			}	
//        }
    }
	
//	public static int[] shuffle(int arr[], Random gen) {
//		for(int i = 0, n = arr.length; i < n; i++)
//		{
//			int index = gen.nextInt(n - i) + i;
//			int temp = arr[i];
//			arr[i] = arr[index];
//			arr[index] = temp;
//		}
//		return arr;
//	}
//
//	public static boolean triangle(long a, long b, long c){
//	    return ((a+b) > c && (b+c) >a && (a+c) > b);
//	}
//		
//	public static boolean isPerfectSquare(long n){
//		if (n < 0) 
//	    	return false;
//	    long test = (long) (Math.sqrt(n) + 0.5);
//	    return test*test == n;
//	}
//		
//	public static int isnum(char s){
//		if(s=='1' || s=='2' || s=='3' || s=='4' || s=='5' || s=='6' || s=='7' || s=='8' || s=='9' || s=='0') 
//	    	return 1; 
//		return 0;
//	}
//		
//	public static long nextPowerOf2(long n){
//	    n--;
//	    n |= n >> 1;
//	    n |= n >> 2;
//	    n |= n >> 4;
//	    n |= n >> 8;
//	    n |= n >> 16;
//	    n++;
//	    return n;
//	}
//		
//	public static long gcd(long a, long b){
//	    long t; 
//	    while (b > 0){ 
//	    	a = a%b; 
//	    	t = a; 
//	    	a = b; 
//	    	b = t; 
//    	}
//	    return a;
//	}
//		
//	public static void sieve(int n){
//		prime=new boolean[sievesize+1];
//	    long x, y; 
//	    prime[0] = prime[1] = true;
//	    for(x = 2; x * x <= sievesize; x++)
//	    { 
//	    	if(!prime[(int) x])
//	    		for(y = x * x; y <= sievesize; y += x) 
//	    			prime[(int) y]=true; 
//	    }
//	}
	
	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        
        public long nextLong() {
        	return Long.parseLong(next());
        }
        
        public int[] nextIntArray(int size) {
        	while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        	int[] arr=new int[size];
        	for(int i = 0; i < size; i++) 
        		arr[i] = Integer.parseInt(tokenizer.nextToken());
        	return arr;
        }

        public long[] nextLongArray(int size) {
        	while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        	long[] arr=new long[size];
        	for(int i = 0; i < size; i++) 
        		arr[i] = Long.parseLong(tokenizer.nextToken());
        	return arr;
        }
        
        public double[] nextDoubleArray(int size) {
        	while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        	double[] arr=new double[size];
        	for(int i = 0; i < size; i++) 
        		arr[i] = Double.parseDouble(tokenizer.nextToken());
        	return arr;
        }
        
        public String[] nextStringArray(int size) throws IOException {
        	String[] arr=new String[size];
        	for(int i = 0; i < size; i++) 
        		arr[i] = reader.readLine();
        	return arr;
        }
        
        public char[] nextCharArray(int size) throws IOException {
        	char[] arr=reader.readLine().toCharArray();
        	return arr;
        }
    }
	
	static class OutputWriter {
		public PrintWriter pw;
		
		public OutputWriter(OutputStream stream) {
			pw = new PrintWriter(stream);
		}
		
		public void println(Object str) {
			pw.println(str);
		}
		
		public void print(Object str) {
			pw.print(str + " ");
		}
		
		public void close() {
			pw.close();
		}
		
		public void flush() {
			pw.flush();
		}
		
		public void printIntArray(int[] arr) {
			for(int i = 0; i < arr.length; i++)
				pw.print(arr[i] + " ");
		}
		
		public void printLongArray(long[] arr) {
			for(int i = 0; i < arr.length; i++)
				pw.print(arr[i] + " ");
		}
		
		public void printCharArray(char[] arr) {
			for(int i = 0; i < arr.length; i++)
				pw.print(arr[i] + " ");
		}
		
		public void printFloatArray(float[] arr) {
			for(int i = 0; i < arr.length; i++)
				pw.print(arr[i] + " ");
		}
		
		public void printDoubleArray(double[] arr) {
			for(int i = 0; i < arr.length; i++)
				pw.print(arr[i] + " ");
		}
	}
}