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>
using namespace std;
pair<double, double> operator-(const pair<double, double>& lhs,
                               const pair<double, double>& rhs) {
  return pair<double, double>(lhs.first - rhs.first, lhs.second - rhs.second);
}
pair<double, double> operator+(const pair<double, double>& lhs,
                               const pair<double, double>& rhs) {
  return pair<double, double>(lhs.first + rhs.first, lhs.second + rhs.second);
}
pair<double, double> operator*(double t, pair<double, double> p) {
  return pair<double, double>(t * p.first, t * p.second);
}
pair<double, double> operator/(pair<double, double> p, double t) {
  return pair<double, double>(p.first / t, p.second / t);
}
pair<double, double> rot(pair<double, double> p) {
  return pair<double, double>(-p.second, p.first);
}
double Cross(const pair<double, double>& lhs, const pair<double, double>& rhs) {
  return lhs.first * rhs.second - lhs.second * rhs.first;
}
double Dot(const pair<double, double>& lhs, const pair<double, double>& rhs) {
  return lhs.first * rhs.first + lhs.second * rhs.second;
}
double Dist2(const pair<double, double>& lhs, const pair<double, double>& rhs) {
  return Dot(lhs - rhs, lhs - rhs);
}
double Dist(const pair<double, double>& lhs, const pair<double, double>& rhs) {
  return sqrt(Dist2(lhs, rhs));
}
int x[100 * 1000 + 2];
double dp[8][1 << 8];
double d[8][8];
vector<pair<double, double> > ps;
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n + 2; i++) {
    scanf("%d", x + i);
  }
  pair<double, double> a = pair<double, double>(x[n], x[n + 1]);
  double b = x[k - 1];
  sort(x, x + n);
  double ret = 1e10;
  if (k == n + 1) {
    ret = min(ret, x[n - 1] - x[0] + Dist(a, pair<double, double>(x[0], 0)));
    ret =
        min(ret, x[n - 1] - x[0] + Dist(a, pair<double, double>(x[n - 1], 0)));
  } else {
    for (int i = 0; i < n; i++) {
      double p = 0;
      if (b <= x[i]) {
        p += x[i] - x[0] +
             min(b - x[0] + Dist(a, pair<double, double>(x[i], 0)),
                 x[i] - b + Dist(a, pair<double, double>(x[0], 0)));
        if (i + 1 < n) {
          p += x[n - 1] - x[i + 1] +
               min(Dist(a, pair<double, double>(x[n - 1], 0)),
                   Dist(a, pair<double, double>(x[i + 1], 0)));
        }
      } else {
        p += x[i] - x[0] +
             min(Dist(a, pair<double, double>(x[i], 0)),
                 Dist(a, pair<double, double>(x[0], 0)));
        if (i + 1 < n) {
          p += x[n - 1] - x[i + 1] +
               min(b - x[i + 1] + Dist(a, pair<double, double>(x[n - 1], 0)),
                   x[n - 1] - b + Dist(a, pair<double, double>(x[i + 1], 0)));
        }
      }
      ret = min(ret, p);
    }
  }
  printf("%.17lf\n", ret);
  return 0;
}