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.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.InputMismatchException;

import javax.swing.plaf.basic.BasicInternalFrameTitlePane.MaximizeAction;




public class asdfgf {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		InputReader in=new InputReader(System.in);
		OutputWriter out=new OutputWriter(System.out);
		int n=in.readInt();
		int point=in.readInt();
		
		int dis[]=new int[n];
		for(int i=0;i<n;i++){
			dis[i]=in.readInt();
		}
		P obj=new P();
		obj.MergeSort(dis, 0, n-1);
		if(n==1){
			out.printLine(0);
		}
		else{
		if(point<=dis[0]){
			out.printLine(Math.abs(dis[n-2]-point));
		}
		else if(point>=dis[n-1])
		{
			out.printLine(Math.abs(dis[1]-point));
		}
		else{
			int firstind=Integer.MIN_VALUE;
			long min=Integer.MAX_VALUE;
			for(int i=0;i<n;i++){
				if(dis[i]<=point){
					firstind=i;
				}
				else{
					break;
				}
			}
			//out.printLine(firstind);
			
			for(int i=firstind+1;i<n;i++){
			//	out.printLine(i);
				if(i-(n-2)>=0){
					
				long sum=dis[i]-point;
				if(sum<(dis[i]-dis[i-(n-2)])){
					sum=sum+(dis[i]-dis[i-(n-2)]);
				}
			//	out.printLine(sum);
				if(sum<min){
					min=sum;
				}
				}
			}
			
			for(int i=firstind;i>=0;i--){
				if(i+n-2<n){
				long sum=point-dis[i];
				if(sum<(dis[i+n-2]-dis[i])){
					sum=sum+(dis[i+n-2]-dis[i]);
				}
				
				if(sum<min){
					min=sum;
				}
				}
			}
			
			
			
			
			
			
			out.printLine(min);	
			
		}
		
		
		
		
		}
		
out.close();
	}

}
class P {
	
static	void MergeSort(int array[], int left, int right)
	{
	        int mid = (left+right)/2;
	        /* We have to sort only when left<right because when left=right it is anyhow sorted*/
	        if(left<right)
	        {
	                /* Sort the left part */
	                MergeSort(array,left,mid);
	                /* Sort the right part */
	                MergeSort(array,mid+1,right);
	                /* Merge the two sorted parts */
	                Merge(array,left,mid,right);
	        }
	}
	/* Merge functions merges the two sorted parts. Sorted parts will be from [left, mid] and [mid+1, right].
	 */
static	void Merge(int array[], int left, int mid, int right)
	{
	        /*We need a Temporary array to store the new sorted part*/
	        int tempArray[]=new int[right-left+1];
	        int pos=0,lpos = left,rpos = mid + 1;
	        while(lpos <= mid && rpos <= right)
	        {
	                if(array[lpos] < array[rpos])
	                {
	                        tempArray[pos++] = array[lpos++];
	                }
	                else
	                {
	                        tempArray[pos++] = array[rpos++];
	                }
	        }
	        while(lpos <= mid)  tempArray[pos++] = array[lpos++];
	        while(rpos <= right)tempArray[pos++] = array[rpos++];
	        int iter;
	        /* Copy back the sorted array to the original array */
	        for(iter = 0;iter < pos; iter++)
	        {
	                array[iter+left] = tempArray[iter];
	        }
	        return;
	}
	

}
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 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);
	}
}
 
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 printLine(Object...objects) {
		print(objects);
		writer.println();
	}
 
	public void close() {
		writer.close();
	}
 
	public void flush() {
		writer.flush();
	}
 
	}
 
class IOUtils {
 
	public static int[] readIntArray(InputReader in, int size) {
		int[] array = new int[size];
		for (int i = 0; i < size; i++)
			array[i] = in.readInt();
		return array;
	}
 
	}