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;
bool deb_mode = 0;
class debugger {
  vector<string> vars;

 public:
  template <typename T>
  debugger &operator,(const T v) {
    stringstream ss;
    ss << v, vars.push_back(ss.str());
    return *this;
  }
  void printall() {
    int j = 0, l = vars.size();
    for (int i = 0; i < (l - 1); i++) {
      if (i) cout << ", ";
      for (j; j < vars[l - 1].size(); j++) {
        if (vars[l - 1][j] == ',') {
          j++;
          break;
        }
        cout << vars[l - 1][j];
      }
      cout << " = " << vars[i];
    }
    vars.clear();
  }
} Dbug;
template <typename T1, typename T2>
inline ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  return os << "(" << p.first << "," << p.second << ")";
}
template <typename T>
inline ostream &operator<<(ostream &os, const vector<T> &v) {
  bool first = true;
  os << "{";
  for (unsigned int i = 0; i < v.size(); i++) {
    if (!first) os << ",";
    os << v[i];
    first = false;
  }
  return os << "}";
}
template <typename T>
inline ostream &operator<<(ostream &os, const set<T> &v) {
  bool first = true;
  os << "{";
  for (typename set<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii) {
    if (!first) os << ",";
    os << *ii;
    first = false;
  }
  return os << "}";
}
template <typename T1, typename T2>
inline ostream &operator<<(ostream &os, const map<T1, T2> &v) {
  bool first = true;
  os << "{";
  for (typename map<T1, T2>::const_iterator ii = v.begin(); ii != v.end();
       ++ii) {
    if (!first) os << ",";
    os << *ii;
    first = false;
  }
  return os << "}";
}
template <typename T>
void getarray(T a[], int b, int e) {
  for (int i = b; i < e + b; i++) cin >> a[i];
}
template <typename T>
void printarray(T a[], int b, int e) {
  for (int i = b; i < e - 1 + b; i++) cout << a[i] << " ";
  if (e - 1 + b >= 0) cout << a[e - 1 + b] << endl;
}
template <typename T>
void printV(vector<T> v) {
  int sz = v.size();
  if (sz) cout << v[0];
  for (int i = 1; i < sz; i++) cout << " " << v[i];
  puts("");
}
template <typename T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <typename T>
T BigMod(T b, T p, T m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    T s = BigMod(b, p / 2, m);
    return ((s % m) * (s % m)) % m;
  }
  return ((b % m) * (BigMod(b, p - 1, m) % m)) % m;
}
template <typename T>
T ModInv(T b, T m) {
  return BigMod(b, m - 2, m);
}
template <class T>
inline void read(T &x) {
  bool Minus = 0;
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') Minus = 1, c = getchar();
  for (x = 0; c > 32; c = getchar()) x = x * 10 + c - '0';
  if (Minus) x = -x;
}
char getc() {
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  return c;
}
int CI(int &_x) { return scanf("%d", &_x); }
int CI(int &_x, int &_y) { return scanf("%d %d", &_x, &_y); }
int CI(int &_x, int &_y, int &_z) { return scanf("%d %d %d", &_x, &_y, &_z); }
int CI(int &_a, int &_b, int &_c, int &_d) {
  return scanf("%d %d %d %d", &_a, &_b, &_c, &_d);
}
template <class T>
string toString(T n) {
  ostringstream oss;
  oss << n;
  return oss.str();
}
int toInt(string s) {
  int r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
long long int toLong(string s) {
  long long int r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
bool isVowel(char ch) {
  ch = tolower(ch);
  if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
    return true;
  return false;
}
bool isUpper(char c) { return c >= 'A' && c <= 'Z'; }
bool isLower(char c) { return c >= 'a' && c <= 'z'; }
int dr8[8] = {+1, -1, +0, +0, +1, -1, -1, +1};
int dc8[8] = {+0, +0, -1, +1, +1, +1, -1, -1};
int dr4[4] = {+0, +0, +1, -1};
int dc4[4] = {-1, +1, +0, +0};
int kn8r[8] = {+1, +2, +2, +1, -1, -2, -2, -1};
int kn8c[8] = {+2, +1, -1, -2, -2, -1, +1, +2};
const double EPS = 1e-9;
const int INF = (1 << 30) - 1;
const long long int LINF = (1ll << 62) - 1;
const int mod = (int)1e9 + 7;
const int MAX = (int)1e5;
int K, N;
vector<int> x;
vector<double> d;
double func(int l, int r) {
  if (deb_mode) {
    cout << "Line= " << 222 << " -> ";
    Dbug, l, r, "l, r";
    Dbug.printall();
    cout << endl;
  };
  if (l > r) return 0;
  return min(d[l], d[r]) + x[r] - x[l];
}
double f(int l, int r) {
  double len = x[r] - x[l];
  if (deb_mode) {
    cout << "Line= " << 228 << " -> ";
    Dbug, len, x[r], x[l], x[K], d[l], d[r],
        "len, x[r], x[l], x[K], d[l], d[r]";
    Dbug.printall();
    cout << endl;
  }
  if (deb_mode) {
    cout << "Line= " << 229 << " -> ";
    Dbug, x[K] - x[l] + d[l], x[r] - x[K] + d[r],
        "x[K] - x[l] + d[l], x[r] - x[K] + d[r]";
    Dbug.printall();
    cout << endl;
  };
  if (l <= K && K <= r)
    return len + min(x[K] - x[l] + d[r], x[r] - x[K] + d[l]);
  else
    return func(l, r);
}
int main() {
  if (deb_mode) srand(int(time(NULL)));
  cout << fixed;
  cout << setprecision(10);
  int i, j, l, n, m, q, a, b, c;
  CI(N, K);
  x.resize(N);
  d.resize(N);
  for (i = 0; i < N; i++) {
    CI(x[i]);
  }
  int first, second;
  cin >> first >> second;
  K--;
  int startX = -1;
  if (K < N) startX = x[K];
  sort(x.begin(), x.end());
  if (K == N)
    K = N;
  else
    K = lower_bound(x.begin(), x.end(), startX) - x.begin();
  for (i = 0; i < N; i++) d[i] = hypot(first - x[i], second);
  double Ans = 1e18;
  if (K == N) {
    Ans = func(0, N - 1);
    cout << Ans << "\n";
    return 0;
  }
  double ab[MAX + 7] = {}, ba[MAX + 7] = {};
  if (deb_mode) {
    cout << "Line= " << 268 << " -> ";
    Dbug, K, "K";
    Dbug.printall();
    cout << endl;
  };
  double res = 0;
  for (i = 1; i <= N; i++) {
    ab[i] = f(0, i - 1);
    if (deb_mode) {
      cout << "Line= " << 272 << " -> ";
      Dbug, i, ab[i], "i, ab[i]";
      Dbug.printall();
      cout << endl;
    };
  }
  for (i = 0; i < N; i++) {
    ba[i] = f(i, N - 1);
    if (deb_mode) {
      cout << "Line= " << 276 << " -> ";
      Dbug, i, ba[i], "i, ba[i]";
      Dbug.printall();
      cout << endl;
    };
  }
  for (i = 0; i <= N; i++) {
    Ans = min(Ans, ab[i] + ba[i]);
    if (deb_mode) {
      cout << "Line= " << 280 << " -> ";
      Dbug, i, ab[i], ba[i], "i, ab[i], ba[i]";
      Dbug.printall();
      cout << endl;
    };
  }
  cout << Ans << "\n";
  if (deb_mode) cerr << "TIME = " << clock() << " ms" << endl;
  return 0;
}