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;
long long fpm(long long b, long long e, long long m) {
  long long t = 1;
  for (; e; e >>= 1, b = b * b % m) e & 1 ? t = t * b % m : 0;
  return t;
}
template <class T>
inline bool chkmin(T &a, T b) {
  return a < b ? a = b, true : false;
}
template <class T>
inline bool chkmax(T &a, T b) {
  return a > b ? a = b, true : false;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class edge>
struct Graph {
  vector<vector<edge> > adj;
  Graph(int n) {
    adj.clear();
    adj.resize(n + 5);
  }
  void adde(int s, edge e) { adj[s].push_back(e); }
  typename vector<edge>::iterator operator[](int t) { return adj[t].begin(); }
};
const int maxn = 110000;
int x[maxn], y, n, k;
double dist(int L, int R) {
  if (L > R) return 0;
  return min(hypot(y, x[1 + n] - x[L]), hypot(y, x[1 + n] - x[R])) + x[R] -
         x[L];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 1; i <= n + 1; ++i) cin >> x[i];
  cin >> y;
  cout << setprecision(15);
  int bak = x[k], xw = x[n + 1];
  sort(x + 1, x + 1 + n);
  if (k > n) return cout << dist(1, n) << endl, 0;
  k = lower_bound(x + 1, x + 1 + n, bak) - x;
  double ans = hypot(x[k] - xw, y) + dist(1, n);
  for (int i = 1; i <= n; ++i) {
    ans = min(ans, fabs(x[k] - x[n]) + fabs(x[n] - x[i]) +
                       dist(1, min(i, k) - 1) + hypot(x[i] - xw, y));
    ans = min(ans, fabs(x[k] - x[1]) + fabs(x[1] - x[i]) +
                       dist(max(i, k) + 1, n) + hypot(x[i] - xw, y));
    ans = min(ans, fabs(x[k] - x[i]) + fabs(x[i] - x[n]) +
                       dist(1, min(i, k) - 1) + hypot(x[n] - xw, y));
    ans = min(ans, fabs(x[k] - x[i]) + fabs(x[i] - x[1]) +
                       dist(max(i, k) + 1, n) + hypot(x[1] - xw, y));
  }
  cout << ans << endl;
  return 0;
}