#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long pw(long long a, long long b, long long p) {     if (b == 0) return 1;     long long t = pw(a, b / 2, p);     if (b % 2)       return ((a * t * t) % p);     else       return ((t * t) % p);   }   map<long long, pair<long long, long long> > m;   long long b[100005];   void solve() {     long long n, k;     cin >> n >> k;     long long a[n];     for (long long i = 1; i <= n; i++) cin >> a[i];     sort(a + 1, a + n + 1);     for (long long j = 1; j <= n; j++) {       long long i = a[j];       b[j] = i;       b[j] += b[j - 1];       m[i].first++;       if (m[i].first == 1) m[i].second = j;     }     long long mx = 0, mn = -1;     for (auto z : m) {       long long lmx = 0;       lmx += z.second.first;       long long u = z.second.second, l = 0, f = u - 1;       while (u >= l) {         long long mid = (l + u) / 2;         long long ss = b[z.second.second - 1] - b[mid];         ss = z.first * (z.second.second - mid - 1) - ss;         if (k < ss) {           l = mid + 1;         }         if (k >= ss) {           f = mid;           u = mid - 1;         }       }       lmx += z.second.second - f - 1;       if (lmx > mx) {         mx = lmx;         mn = z.first;       }     }     cout << mx <<     << mn;   }   signed main() {     ios_base::sync_with_stdio(false);     long long t = 1;     while (t--) solve();     return 0;   }   