func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 5e5 + 1;   long long arr[N];   long long n, k;   long long sum;   long long mnm = -1;   long long mxm = -1;   void input() {     cin >> n >> k;     for (long long i = 0; i < n; ++i) {       cin >> arr[i];       sum += arr[i];     }     sort(arr, arr + n);   }   void solve() {     long long K = k;     for (long long i = 0; i < n;) {       long long j = i;       for (; j < n && arr[i] == arr[j]; ++j)         ;       long long dif = arr[j] - arr[i];       long long cnt = j;       if (K >= dif * cnt) {         K -= dif * cnt;       } else {         mnm = arr[i] + K / j;         break;       }       i = j;     }     K = k;     for (long long i = n - 1; i >= 0;) {       long long j = i;       for (; j >= 0 && arr[i] == arr[j]; --j)         ;       long long dif = arr[i] - arr[j];       long long cnt = n - 1 - j;       if (K >= dif * cnt) {         K -= dif * cnt;       } else {         mxm = arr[i] - K / cnt;         break;       }       i = j;     }     if (mnm == -1) mnm = arr[n - 1];     if (mxm == -1) mxm = arr[0];     if (mnm >= mxm) {       if (sum % n) {         cout <<  1 n ;       } else {         cout <<  0 n ;       }     } else {       cout << mxm - mnm <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0), cout.tie(0);     input();     solve();   }   