#include using namespace std; using ll = long long; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } template ostream& operator << (ostream& os, const vector& vec) { if(vec.empty()) return os; os << vec[0]; for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it; return os; } int main(){ ios::sync_with_stdio(false); cin.tie(0); ll n, k; cin >> n >> k; vector a(n); cin >> a; sort(a.begin(), a.end()); ll ans = 0, ans1 = k; for(; ans < n; ans++){ if(ans1 >= a[ans]){ ans1 -= a[ans]; continue; } break; } cout << ans << " " << ans1 << '\n'; }