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.*;


import static java.lang.Math.*;



public class IDontKnow {
    public static void main(String [] args){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Integer readFromFile=new Integer(1);
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }
    static class TaskD {
        final int MAXVALUE = 100_000;
        /*
        // numChec (List<Integer>)  - the number of checkpoint
        //befLas (int)  - the element whith is locatend before the last;
        //las (int) - the last element of numChec
        //answer (int) - the sum of true of
        */
        class ComparePoint implements Comparator<Integer> {
            @Override
            public int compare(Integer o1, Integer o2) {
                return (o1.intValue()-o2.intValue())*-1;
            }
        }
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int a = in.nextInt();
            List<Integer> numChec = new ArrayList<>(MAXVALUE);
            for(int i=0; i<n; i++){
                numChec.add(in.nextInt());
            }
            Collections.sort(numChec);
            if(n==1){
                out.println(0);
                return;
            }else if(n==2){
                out.println(min(abs(a-numChec.get(0)), abs(a-numChec.get(1))));
            }else{
                int befLast = numChec.size()-2;
                int last =  numChec.size()-1;
                List<Integer> setValue = new ArrayList<>(4);
                setValue.add(abs(numChec.get(last)-a)+ numChec.get(last)-numChec.get(1));
                setValue.add(abs(numChec.get(befLast)-a)+numChec.get(befLast)-numChec.get(0));
                setValue.add(abs(numChec.get(1) - a) + numChec.get(last)-numChec.get(1));
                setValue.add(abs(numChec.get(0) - a) + numChec.get(befLast)- numChec.get(0));
                Collections.sort(setValue, new ComparePoint());
                out.println(setValue.get(setValue.size()-1));
            }
        }
    }
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;
        String st1;
        File file = new File("text.txt");
        public InputReader(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
            st = null;
        }
        public InputReader(int i) {
            try {
                br  = new BufferedReader(
                        new InputStreamReader(new FileInputStream(file)));
            } catch (FileNotFoundException e1) {
                System.out.println("File is not find");
            }
            st = null;
        }
        public String next(){
            while (st==null || !st.hasMoreTokens()){
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public String nextLine(){
            try {
                st1 = new String(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            //return st1.split(" ").;
            return st1;
        }
        public int nextInt()  {
            return Integer.parseInt(next());
        }
        public long nextLong(){
            return Long.parseLong(next());
        }
        public Double nextDouble(){
            return Double.parseDouble(next());
        }
        public Byte nextByte() {
            return Byte.parseByte(next());
        }
        //public Character nextChar() {return Character.}
        public void newFile() {
            try {
                FileWriter write = new FileWriter(file);
                write.write(1);
                write.close();

            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
