#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  ~debug() { cerr << endl; }
  template <class c>
  typename enable_if<sizeof dud<c>(0) != 1, debug&>::type operator<<(c i) {
    cerr << boolalpha << i;
    return *this;
  }
  template <class c>
  typename enable_if<sizeof dud<c>(0) == 1, debug&>::type operator<<(c i) {
    return *this << range(begin(i), end(i));
  }
  template <class c, class b>
  debug& operator<<(pair<b, c> d) {
    return *this << "(" << d.first << ", " << d.second << ")";
  }
  template <class c>
  debug& operator<<(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it;
    return *this << "]";
  }
};
long double eps = (long double)1 / 1e6;
const long double pi = 3.14159265359;
long long inf = 1e18, mod1 = 1e9 + 7;
long long sqr(long long a) { return a * a; }
long long qb(long long a) { return a * a * a; }
template <typename T>
bool umax(T& a, T b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
bool umin(T& a, T b) {
  return b < a ? a = b, 1 : 0;
}
bool is_prime(long long val) {
  for (long long i = 2; i <= sqrt(val); i++)
    if (val % i == 0) return 0;
  return 1;
}
long long gcd(long long a, long long b) { return !a ? b : gcd(b % a, a); }
long long binpow(long long a, long long b, long long mod) {
  return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod
                    : sqr(binpow(a, b / 2, mod)) % mod)
           : 1;
}
long long binmult(long long a, long long b, long long mod) {
  return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod
                    : (2 * binmult(a, b / 2, mod)) % mod)
           : 0;
}
const long long RR = 1e4;
const long long tx[8] = {1, -1, 2, -2, -1, -2};
const long long ty[8] = {-2, -2, -1, -1, 2, 1};
const char rev_to[4] = {'E', 'W', 'N', 'S'};
const int M = 999999937;
const int N = 1e5 + 100;
const int ppp = 73;
const int block = 320;
auto rnd = bind(uniform_int_distribution<long long>(1, 125), mt19937(time(0)));
void bad() {
  cout << "NO SOLUTION";
  exit(0);
}
vector<int> a;
long long k;
int n;
long long pref[N];
long long get(int l, int r) {
  if (r < 0) return 0;
  return pref[r] - (l ? pref[l - 1] : 0);
}
long long cnt(int l, int r) {
  int first = lower_bound(a.begin(), a.end(), l) - a.begin();
  long long w = 1ll * l * first - get(0, first - 1);
  first = upper_bound(a.begin(), a.end(), r) - a.begin();
  w += get(first, n - 1) - (n - first) * 1ll * r;
  return w;
}
bool ok(int mid) {
  for (int i = 0; i < n; i++) {
    int l = a[i], r = a[i] + mid;
    if (cnt(l, r) <= k) return 1;
    l = a[i] - mid, r = a[i];
    if (cnt(l, r) <= k) return 1;
  }
  return 0;
}
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  cin >> n >> k;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) {
    pref[i] = a[i];
    if (i) pref[i] += pref[i - 1];
  }
  int l = 0, r = 2e9;
  while (l != r) {
    int tm = (l + r) >> 1;
    if (ok(tm))
      r = tm;
    else
      l = tm + 1;
  }
  cout << l;
  return 0;
}

### Prompt

Develop a solution in CPP to the problem described below:

You are given a sequence a_1, a_2, ..., a_n consisting of n integers.

You may perform the following operation on this sequence: choose any element and either increase or decrease it by one.

Calculate the minimum possible difference between the maximum element and the minimum element in the sequence, if you can perform the aforementioned operation no more than k times.

Input

The first line contains two integers n and k (2 ≤ n ≤ 10^{5}, 1 ≤ k ≤ 10^{14}) — the number of elements in the sequence and the maximum number of times you can perform the operation, respectively.

The second line contains a sequence of integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^{9}).

Output

Print the minimum possible difference between the maximum element and the minimum element in the sequence, if you can perform the aforementioned operation no more than k times.

Examples

Input


4 5
3 1 7 5


Output


2


Input


3 10
100 100 100


Output


0


Input


10 9
4 5 5 7 5 4 5 2 4 3


Output


1

Note

In the first example you can increase the first element twice and decrease the third element twice, so the sequence becomes [3, 3, 5, 5], and the difference between maximum and minimum is 2. You still can perform one operation after that, but it's useless since you can't make the answer less than 2.

In the second example all elements are already equal, so you may get 0 as the answer even without applying any operations.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  ~debug() { cerr << endl; }
  template <class c>
  typename enable_if<sizeof dud<c>(0) != 1, debug&>::type operator<<(c i) {
    cerr << boolalpha << i;
    return *this;
  }
  template <class c>
  typename enable_if<sizeof dud<c>(0) == 1, debug&>::type operator<<(c i) {
    return *this << range(begin(i), end(i));
  }
  template <class c, class b>
  debug& operator<<(pair<b, c> d) {
    return *this << "(" << d.first << ", " << d.second << ")";
  }
  template <class c>
  debug& operator<<(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it;
    return *this << "]";
  }
};
long double eps = (long double)1 / 1e6;
const long double pi = 3.14159265359;
long long inf = 1e18, mod1 = 1e9 + 7;
long long sqr(long long a) { return a * a; }
long long qb(long long a) { return a * a * a; }
template <typename T>
bool umax(T& a, T b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
bool umin(T& a, T b) {
  return b < a ? a = b, 1 : 0;
}
bool is_prime(long long val) {
  for (long long i = 2; i <= sqrt(val); i++)
    if (val % i == 0) return 0;
  return 1;
}
long long gcd(long long a, long long b) { return !a ? b : gcd(b % a, a); }
long long binpow(long long a, long long b, long long mod) {
  return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod
                    : sqr(binpow(a, b / 2, mod)) % mod)
           : 1;
}
long long binmult(long long a, long long b, long long mod) {
  return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod
                    : (2 * binmult(a, b / 2, mod)) % mod)
           : 0;
}
const long long RR = 1e4;
const long long tx[8] = {1, -1, 2, -2, -1, -2};
const long long ty[8] = {-2, -2, -1, -1, 2, 1};
const char rev_to[4] = {'E', 'W', 'N', 'S'};
const int M = 999999937;
const int N = 1e5 + 100;
const int ppp = 73;
const int block = 320;
auto rnd = bind(uniform_int_distribution<long long>(1, 125), mt19937(time(0)));
void bad() {
  cout << "NO SOLUTION";
  exit(0);
}
vector<int> a;
long long k;
int n;
long long pref[N];
long long get(int l, int r) {
  if (r < 0) return 0;
  return pref[r] - (l ? pref[l - 1] : 0);
}
long long cnt(int l, int r) {
  int first = lower_bound(a.begin(), a.end(), l) - a.begin();
  long long w = 1ll * l * first - get(0, first - 1);
  first = upper_bound(a.begin(), a.end(), r) - a.begin();
  w += get(first, n - 1) - (n - first) * 1ll * r;
  return w;
}
bool ok(int mid) {
  for (int i = 0; i < n; i++) {
    int l = a[i], r = a[i] + mid;
    if (cnt(l, r) <= k) return 1;
    l = a[i] - mid, r = a[i];
    if (cnt(l, r) <= k) return 1;
  }
  return 0;
}
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  cin >> n >> k;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) {
    pref[i] = a[i];
    if (i) pref[i] += pref[i - 1];
  }
  int l = 0, r = 2e9;
  while (l != r) {
    int tm = (l + r) >> 1;
    if (ok(tm))
      r = tm;
    else
      l = tm + 1;
  }
  cout << l;
  return 0;
}

```