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:
import java.io.*;
import java.util.*;
public class D30 {
public static void main(String[] args) throws IOException {
	input.init(System.in);
	PrintWriter out = new PrintWriter(System.out);
	int n = input.nextInt(), k = input.nextInt() - 1;
	Point[] data = new Point[n+1];
	int[] xs = new int[n];
	for(int i = 0; i<n; i++) xs[i] = input.nextInt();
	int mark = -1;
	if(k < n)
	{
		mark = xs[k];
	}
	Arrays.sort(xs);
	if(mark != -1)
	{
		for(int i = 0; i<n; i++) if(xs[i] == mark) k = i;
	}
	for(int i = 0; i<n; i++) data[i] = new Point(xs[i], 0);
	data[n] = new Point(input.nextDouble(), input.nextDouble());
	if(k == n)
	{
		double res = Math.min(data[0].dist(data[k]), data[n-1].dist(data[k]));
		for(int i = 0; i<n-1; i++) res += data[i].dist(data[i+1]);
		out.println(res);
	}
	else
	{
		double res = 1e18;
		for(int i = k; i<n; i++)
		{
			double cur = data[i].dist(data[k]) + data[i].dist(data[0]) + data[0].dist(data[n]);
			cur = Math.min(cur, data[k].dist(data[0]) + data[0].dist(data[i]) + data[i].dist(data[n]));
			if(i != n-1)
			{
				cur += data[n-1].dist(data[i+1]);
				cur += Math.min(data[n-1].dist(data[n]), data[i+1].dist(data[n]));
			}
			//out.println(i+" "+cur);
			if(cur<res) res = cur;
		}
		for(int i = 0; i<= k; i++)
		{
			double cur = data[i].dist(data[k]) + data[i].dist(data[n-1]);
			cur += data[n-1].dist(data[n]);
			cur = Math.min(cur, data[k].dist(data[n-1]) + data[n-1].dist(data[i]) + data[i].dist(data[n]));
			if(i != 0)
			{
				cur += data[0].dist(data[i-1]);
				cur += Math.min(data[0].dist(data[n]), data[i-1].dist(data[n]));
			}
			if(cur < res) res = cur;
		}
		out.println(res);
	}
	
	out.close();
}
static class Point
{
	double x, y;
	public Point(double xx, double yy)
	{
		x = xx; y = yy;
	}
	double dist(Point p)
	{
		return Math.sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y));
	}
}
public static class input {
	static BufferedReader reader;
	static StringTokenizer tokenizer;

	static void init(InputStream input) {
		reader = new BufferedReader(new InputStreamReader(input));
		tokenizer = new StringTokenizer("");
	}

	static String next() throws IOException {
		while (!tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(reader.readLine());
		return tokenizer.nextToken();
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	static long nextLong() throws IOException {
		return Long.parseLong(next());
	}
}
}