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;
struct Vec {
  double x, y;
  Vec(double nx = 0, int ny = 0) {
    x = nx;
    y = ny;
  }
  Vec operator-(Vec r) { return Vec(x - r.x, y - r.y); }
  bool operator==(Vec r) { return x == r.x && y == r.y; }
};
bool operator<(Vec l, Vec r) {
  if (l.x < r.x) return true;
  if (l.x > r.x) return false;
  return l.y < r.y;
}
double len(Vec v) { return hypot(v.x, v.y); }
int main() {
  int n, k;
  cin >> n >> k;
  vector<Vec> pts(n);
  for (int i = 0; i < n; i++) cin >> pts[i].x;
  Vec up, start;
  cin >> up.x >> up.y;
  if (k <= n)
    start = pts[k - 1];
  else
    start = up;
  sort(pts.begin(), pts.end());
  double result = 1e18;
  if (k == n + 1) {
    result = min(len(pts[0] - up), len(pts.back() - up));
    result += len(pts.back() - pts[0]);
    cout << fixed << setprecision(7) << result << '\n';
    return 0;
  }
  int lb = lower_bound(pts.begin(), pts.end(), start) - pts.begin();
  for (int i = lb; i + 1 < (int)pts.size(); i++) {
    double cur = len(pts[i] - pts[0]);
    cur += min(len(pts[i] - start) + len(up - pts[0]),
               len(pts[0] - start) + len(up - pts[i]));
    cur += len(pts.back() - pts[i + 1]);
    cur += min(len(pts[i + 1] - up), len(pts.back() - up));
    result = min(result, cur);
  }
  for (int i = lb; i > 0; i--) {
    double cur = len(pts.back() - pts[i]);
    cur += min(len(pts[i] - start) + len(up - pts.back()),
               len(pts.back() - start) + len(up - pts[i]));
    cur += len(pts[i - 1] - pts[0]);
    cur += min(len(pts[i - 1] - up), len(pts[0] - up));
    result = min(result, cur);
  }
  {
    double cur = len(pts.back() - pts[0]);
    cur += min(len(pts.back() - start) + len(up - pts[0]),
               len(pts[0] - start) + len(up - pts.back()));
    result = min(result, cur);
  }
  cout << fixed << setprecision(7) << result << '\n';
  return 0;
}