Problem: Every true king during his life must conquer the world, hold the Codeforces world finals, win pink panda in the shooting gallery and travel all over his kingdom.

King Copa has already done the first three things. Now he just needs to travel all over the kingdom. The kingdom is an infinite plane with Cartesian coordinate system on it. Every city is a point on this plane. There are n cities in the kingdom at points with coordinates (x1, 0), (x2, 0), ..., (xn, 0), and there is one city at point (xn + 1, yn + 1). 

King starts his journey in the city number k. Your task is to find such route for the king, which visits all cities (in any order) and has minimum possible length. It is allowed to visit a city twice. The king can end his journey in any city. Between any pair of cities there is a direct road with length equal to the distance between the corresponding points. No two cities may be located at the same point.

Input

The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ n + 1) — amount of cities and index of the starting city. The second line contains n + 1 numbers xi. The third line contains yn + 1. All coordinates are integers and do not exceed 106 by absolute value. No two cities coincide.

Output

Output the minimum possible length of the journey. Your answer must have relative or absolute error less than 10 - 6.

Examples

Input

3 1
0 1 2 1
1


Output

3.41421356237309490000

Input

3 1
1 0 2 1
1


Output

3.82842712474619030000

Input

4 5
0 5 -1 -5 2
3


Output

14.24264068711928400000

Solution (in JAVA):

Solution:
//package round30;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class D {
	private Scanner in;
	private PrintWriter out;
//	private String INPUT = "4 5 0 5 -1 -5 2 3";
//	private String INPUT = "3 1 0 1 2 1 1";
//	private String INPUT = "3 1 1 0 2 1 1";
	private String INPUT = "";
	
	public void solve()
	{
		int n = ni();
		int k = ni() - 1;
		int[] x = new int[n];
		for(int i = 0;i < n;i++){
			x[i] = ni();
		}
		int ux = ni();
		int uy = ni();
		int xk = 0;
		if(k < n){
			xk = x[k];
		}
		
		Arrays.sort(x);
		if(k == n){
			out.println(fall(x[0], x[n-1], ux, uy));
		}else{
			double maxv = Math.min(
					2 * (x[n-1] - xk) + xk - x[0] + Math.sqrt(d2(x[0], 0, ux, uy)),
					2 * (xk - x[0]) + x[n-1] - xk + Math.sqrt(d2(x[n-1], 0, ux, uy))
					);
			tr(maxv);
			// erase 0-k-i
			for(int i = 0;i < n - 1;i++){
				if(x[i] >= xk){
					double v = Math.min(
							2 * (x[i] - xk) + xk - x[0] + Math.sqrt(d2(x[0], 0, ux, uy)),
							2 * (xk - x[0]) + x[i] - xk + Math.sqrt(d2(x[i], 0, ux, uy))
							) + fall(x[i+1], x[n-1], ux, uy);
					maxv = Math.min(maxv, v);
				}
			}
			tr(maxv);
			// erase i-k-(n-1)
			for(int i = n - 1;i >= 1;i--){
				if(x[i] <= xk){
					double v = Math.min(
							2 * (x[n-1] - xk) + xk - x[i] + Math.sqrt(d2(x[i], 0, ux, uy)),
							2 * (xk - x[i]) + x[n-1] - xk + Math.sqrt(d2(x[n-1], 0, ux, uy))
							) + fall(x[0], x[i-1], ux, uy);
					maxv = Math.min(maxv, v);
				}
			}
			out.println(maxv);
		}
	}
	
	public double fall(int f, int t, int ux, int uy)
	{
		return Math.sqrt(Math.min(d2(f, 0, ux, uy), d2(t, 0, ux, uy))) + t - f;
	}
	
	public long d2(long ax, long ay, long bx, long by)
	{
		return (ax - bx) * (ax - bx) + (ay - by) * (ay - by);
	}
	
	public void run() throws Exception
	{
		in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
		out = new PrintWriter(System.out);

		solve();
		out.flush();
	}
	
	
	public static void main(String[] args) throws Exception
	{
		new D().run();
	}
	
	private int ni() { return Integer.parseInt(in.next()); }
	private void tr(Object... o) { if(INPUT.length() != 0)System.out.println(o.length > 1 || o[0].getClass().isArray() ? Arrays.deepToString(o) : o[0]); }
}