#include #define int long long #define all(x) (x).begin(),(x).end() using namespace std; signed main() { int n, k; cin >> n >> k; vector a(n); for (int i = 0; i < n; i ++ ) cin >> a[i]; sort(all(a)); for (int i = 1; i < n; i ++ ) a[i] += a[i - 1]; int out = -1; for (int i = 0; i < n; i ++ ){ if (a[i] > k){ out = i; break; } } if (out == -1) cout << n << " " << k - a[n - 1] << endl; else cout << out << " " << (out ? k - a[out - 1] : k) << endl; }