#include <bits/stdc++.h>   using namespace std;   long long get_sum(vector<long long> &prefix, int left, int right) {     if (left != 0)       return prefix[right] - prefix[left - 1];     else       return prefix[right];   }   void To_Add_or_Not_To_Add(vector<long long> &a, long long k) {     int n = a.size();     sort(a.begin(), a.end());     vector<long long> prefix = a;     for (int i = 1; i < n; i++) prefix[i] += prefix[i - 1];     long ans = 0;     int maxFreq = INT_MIN;     for (auto key : a) {       int freq = upper_bound(a.begin(), a.end(), key) -                  lower_bound(a.begin(), a.end(), key);       int low = 0;       int high = lower_bound(a.begin(), a.end(), key) - a.begin();       high--;       long long stock = k;       while (low <= high) {         int mid = (low + high) / 2;         int len = high - mid + 1;         auto req = len * key - get_sum(prefix, mid, high);         if (stock >= req) {           stock -= req;           high = mid - 1;           freq += len;         } else {           low = mid + 1;         }       }       if (freq > maxFreq) {         maxFreq = freq;         ans = key;       }     }     cout << maxFreq <<     << ans << endl;   }   int main() {     int n;     cin >> n;     long long k;     cin >> k;     vector<long long> a(n);     for (auto &ele : a) cin >> ele;     To_Add_or_Not_To_Add(a, k);     return 0;   }   