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.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Queue;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Solution implements Runnable {
	
	public static void main(String[] args) {
		(new Thread(new Solution())).start();
	}
	
	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;
	
	String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	
	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	
	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}
	
	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	
	BigInteger nextBigInteger() throws IOException {
		return new BigInteger(nextToken());
	}
	
	class Point {
		int x, y;
		Point(int a, int b) {
			x = a; y = b;
		}
	}
	
	Point[] a;
	
	double dist(int q, int w) {
		return Math.sqrt((double)(a[q].x - a[w].x) * (a[q].x - a[w].x) + (double)(a[q].y - a[w].y) * (a[q].y - a[w].y));
	}
	
	void solve() throws Exception {
		int n = nextInt();
		int k = nextInt() - 1;
		a = new Point[n + 1];
		for (int i = 0; i < n; i++) a[i] = new Point(nextInt(), 0);
		a[n] = new Point(nextInt(), nextInt());
		int kk = 0;
		for (int i = 0; i < n; i++) {
			if (a[i].x < a[k].x) kk++;
		}
		if (k < n) k = kk;
		Arrays.sort(a, 0, n, new Comparator<Point>() {
			public int compare(Point o1, Point o2) {
				return o1.x - o2.x;
			}
		});
		double ans;
		if (k == n) {
			ans = Math.min(dist(0, n), dist(n - 1, n)) + dist(0, n - 1);
		} else {
			double qq;
			if (n > 1) {
				qq = dist(0, n) + dist(1, n) - dist(0, 1);
				for (int i = 1; i < n - 1; i++) {
					if (dist(i, n) + dist(i + 1, n) - dist(i, i + 1) < qq) qq = dist(i, n) + dist(i + 1, n) - dist(i, i + 1);
				}
			} else qq = dist(0, 1);
			qq += dist(0, n - 1);
			ans = Math.min(dist(0, k), dist(n - 1, k)) + qq;
			if (k < n - 1) {
				double tmp = dist(0, k) + dist(0, n) + Math.min(dist(n, k + 1), dist(n - 1, n)) + dist(k + 1, n - 1);
				ans = Math.min(ans, tmp);
				for (int i = k + 1; i < n - 1; i++) {
					ans = Math.min(ans, dist(k, i) + dist(i, 0) + dist(0, n) + Math.min(dist(n, i + 1), dist(n - 1, n)) + dist(i + 1, n - 1));
				}
			}
			if (k > 0) {
				double tmp = dist(n - 1, k) + dist(n - 1, n) + Math.min(dist(n, k - 1), dist(0, n)) + dist(k - 1, 0);
				ans = Math.min(ans, tmp);
				for (int i = k - 1; i > 0; i--) {
					ans = Math.min(ans, dist(k, i) + dist(i, n - 1) + dist(n - 1, n) + Math.min(dist(n, i - 1), dist(0, n)) + dist(i - 1, 0));
				}
			}
			ans = Math.min(ans, dist(0, n - 1) + Math.min(dist(k, 0) + dist(n - 1, n), dist(k, n - 1) + dist(0, n)));
		}
		out.printf("%.7f", ans);
	}
	        
	public void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
//			in = new BufferedReader(new FileReader(new File("input.txt")));
//			out = new PrintWriter("output.txt");
			solve();
		} catch (Exception e) {
			e.printStackTrace();
		}
		out.flush();
	}

}