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.util.*; import java.io.*; import java.math.*;
public class Main{
	static void solve(){//Here is the main function
      int N = nextInt();
      int A = nextInt();
      ArrayList<Node> list = new ArrayList<>();
      for(int i = 0; i < N; i++){
        list.add(new Node(i, nextInt()));
      }
      list.add(new Node(-1, A));
      Collections.sort(list);
      int index = -1;
      for(int i = 0; i < N + 1; i++){
        if(list.get(i).no == -1){
          index = i;
          break;
        }
      }
      if(index == 0){
        myout(list.get(N - 1).v - list.get(0).v);
      }else if(index == N){
        myout(list.get(N).v - list.get(1).v);
      }else{
        long sum = 1l <<60;
        sum = Math.min(sum, Math.abs(list.get(index).v - list.get(0).v) + Math.abs(list.get(N - 1).v - list.get(0).v));
        sum = Math.min(sum, Math.abs(list.get(N - 1).v - list.get(index).v) + Math.abs(list.get(N - 1).v - list.get(0).v));
        sum = Math.min(sum, Math.abs(list.get(index).v - list.get(N).v) + Math.abs(list.get(N).v - list.get(1).v));
        sum = Math.min(sum, Math.abs(list.get(index).v - list.get(1).v) + Math.abs(list.get(N).v - list.get(1).v));
        myout(sum);
      }
	}
	//Method addition frame start

static class Node implements Comparable<Node>{
  int no;
  int v;
  Node(int no, int v){
    this.no = no;
    this.v = v;
  }
  public int compareTo(Node ato){
    int ret = -1;
    if(this.v == ato.v){
      ret = this.no - ato. no;
    }else{
      ret = this.v - ato.v;
    }
    return ret;
  }
}

	//Method addition frame end

	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.addAll(Arrays.asList(read.split(" ")));
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<String> nextStrArray(int size){
		ArrayList<String> ret = new ArrayList<>(size);
		for(int i = 0; i < size; i++){
			ret.add(next());
		}
		return ret;
	}
	static ArrayList<Integer> nextIntArray(int size){
		ArrayList<Integer> ret = new ArrayList<>(size);
		for(int i = 0; i < size; i++){
			ret.add(Integer.parseInt(next()));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(int size){
		ArrayList<Long> ret = new ArrayList<>(size);
		for(int i = 0; i < size; i++){
			ret.add(Long.parseLong(next()));
		}
		return ret;
	}
	@SuppressWarnings("unchecked")
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
}