#include using namespace std; using ll = long long; int main(){ int n; cin >> n; ll k; cin >> k; vector a(n); for (int i = 0; i < n; i++) cin >> a[i]; sort(a.begin(),a.end()); int ans = 0; for (int i = 0; i < n; i++){ if (a[i] > k) break; ans++; k -= a[i]; } cout << ans << " " << k << endl; }