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.*;
import java.util.Arrays;
import java.util.InputMismatchException;
 

public class Second {

    public static void main(String[] args) throws Exception
    {
        int n = i();
        int a = i();
        int[] x = new int[n];
        for( int i=0 ; i<n ; i++ ) x[i]=i();
        Arrays.sort(x);
        if( n==1 ){
        	System.out.println(0);
        	return;
        }
        long res=Long.MAX_VALUE/2;
        boolean flag=false;
        if( a<=x[0] ){
        	if( n>1 ) res=x[n-2]-a;
        }
//        System.out.println(a+" "+x[1]+" "+(n>1 && a<=x[1])+" "+(x[n-1]-a));
        if( n>1 && a<=x[1] ){
        	res=Math.min(res, x[n-1]-a);
        }
        if( a>=x[n-1] ){
        	if( n>1 ) res=Math.min(res,a-x[1]);
        }
        if( n>1 && a>=x[n-2] )
        	res=Math.min(res, a-x[0]);
        long one,two,three,four;
        one=two=three=four=Long.MAX_VALUE;
       
    	
        if( n>1 && a>=x[1] && a<x[n-1] ){
        	three=2*(a-x[1])+x[n-1]-a;
        	four=a-x[1]+2*(x[n-1]-a);
        }
        if( n>1 && a>x[0] && a<x[n-2] ){
        	 one=2*(a-x[0])+x[n-2]-a;
         	two=a-x[0]+2*(x[n-2]-a);
        }
        res=Math.min(res, Math.min(one, two));
        res=Math.min(three, res);
        res=Math.min(four, res);
        System.out.println(res);
        out.close();
        
    }
 
 	
 	
    static InputReader in = new InputReader(System.in);
    static OutputWriter out = new OutputWriter(System.out);
    
    static int i()
    {
    	return in.readInt();
    }
    
    static long l()
    {
    	return in.readLong();
    }
    
    static double d()
    {
    	return in.readDouble();
    }
    
    static String s()
    {
    	return in.readString();
    }
    
    static void Iarr( int[] array, int no )
    {
    	for( int i=0 ; i<no ; i++ )
    	{
    		array[i] = i(); 
    	}
    }
    
    static void Larr( long[] array, int no )
    {
    	for( int i=0 ; i<no ; i++ )
    	{
    		array[i] = l(); 
    	}
    }
    
    static void Darr( double[] array, int no )
    {
    	for( int i=0 ; i<no ; i++ )
    	{
    		array[i] = d(); 
    	}
    }
    
    static void Sarr( String[] array, int no )
    {
    	for( int i=0 ; i<no ; i++ )
    	{
    		array[i] = s(); 
    	}
    }
    
    private static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
 
        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }
 
        
        
        
        
        
        
        public int read()
        {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                } catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        public int readInt()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
        public double readDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, readInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        public String next()
        {
            return readString();
        }
 
        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }
 
    private static class OutputWriter
    {
        private final PrintWriter writer;
 
        public OutputWriter(OutputStream outputStream)
        {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }
 
        public OutputWriter(Writer writer)
        {
            this.writer = new PrintWriter(writer);
        }
 
        public void print(Object... objects)
        {
            for (int i = 0; i < objects.length; i++)
            {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }
 
        public void println(Object... objects)
        {
            print(objects);
            writer.println();
        }
 
        public void close()
        {
            writer.close();
        }
 
        public void flush()
        {
            writer.flush();
        }
     }
}