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 CPP):

Solution:
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const int INF = 1e9;
const long long INF64 = 1e18;
const long double EPS = 1e-9;
int n, k;
const int N = 100005;
long double first[N];
long double second[N];
pair<long double, long double> f;
void gen() {
  set<int> s;
  n = 4;
  for (int i = 0; i < int(n); ++i) {
    first[i] = rand() % 20;
    if (s.count(first[i]))
      i--;
    else
      s.insert(first[i]);
  }
  k = rand() % n;
  f = make_pair(rand() % 20, rand() % 20);
  sort(first, first + n);
}
bool read() {
  if (!(cin >> n >> k)) return false;
  k--;
  for (int i = 0; i < int(n); ++i) {
    cin >> first[i];
  }
  cin >> f.first >> f.second;
  int st = first[k];
  sort(first, first + n);
  if (k == n) {
    long double ans1 = sqrt(((first[0] - f.first) * (first[0] - f.first)) +
                            ((f.second) * (f.second))) +
                       first[n - 1] - first[0];
    long double ans2 =
        sqrt(((first[n - 1] - f.first) * (first[n - 1] - f.first)) +
             ((f.second) * (f.second))) +
        first[n - 1] - first[0];
    cout << fixed << setprecision(10) << min(ans1, ans2) << endl;
    exit(0);
  }
  for (int i = 0; i < int(n); ++i)
    if (first[i] == st) k = i;
  return true;
}
long double dist(int v) {
  if (v < 0 || v >= n) return 0;
  return sqrt(((f.first - first[v]) * (f.first - first[v])) +
              ((f.second) * (f.second)));
}
long double naive() {
  first[n] = f.first, second[n] = f.second;
  vector<int> v;
  for (int i = 0; i < int(n + 1); ++i) v.push_back(i);
  long double ans = INF;
  do {
    if (v[0] != k) continue;
    long double cur = 0;
    for (int i = 0; i < int(n); ++i) {
      cur += sqrt(
          ((first[v[i]] - first[v[i + 1]]) * (first[v[i]] - first[v[i + 1]])) +
          ((second[v[i]] - second[v[i + 1]]) *
           (second[v[i]] - second[v[i + 1]])));
    }
    ans = min(ans, cur);
  } while (next_permutation(v.begin(), v.end()));
  return ans;
}
void solve() {
  long double ans = INF;
  long double cur = 0;
  for (int i = 0; i < int(n); ++i) {
    cur = first[k] - first[0] + first[i] - first[0];
    cur += dist(i);
    int r = max(i + 1, k + 1);
    if (r < n) cur += min(dist(r), dist(n - 1)) + first[n - 1] - first[r];
    ans = min(ans, cur);
    cur = first[n - 1] - first[k] + first[n - 1] - first[i];
    cur += dist(i);
    int l = min(i - 1, k - 1);
    if (l >= 0) cur += min(dist(0), dist(l)) + first[l] - first[0];
    ans = min(ans, cur);
    cur = abs(first[k] - first[i]) + first[i] - first[0];
    cur += dist(0);
    r = max(i + 1, k + 1);
    if (r < n) cur += min(dist(r), dist(n - 1)) + first[n - 1] - first[r];
    ans = min(ans, cur);
    cur = abs(first[i] - first[k]) + first[n - 1] - first[i];
    cur += dist(n - 1);
    l = min(i - 1, k - 1);
    if (l >= 0) cur += min(dist(0), dist(l)) + first[l] - first[0];
    ans = min(ans, cur);
  }
  cout << fixed << setprecision(10) << ans << endl;
}
int main() {
  while (read()) solve();
  return 0;
}