#include namespace nono { void solve() { int n, k; std::cin >> n >> k; std::vector a(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; } std::sort(a.begin(), a.end()); int ans = 0; for (int v: a) { if (v <= k) { k -= v; ans++; } } std::cout << ans << ' ' << k << std::endl; } } // namespace nono int main() { std::cin.tie(0)->sync_with_stdio(0); std::cout << std::fixed << std::setprecision(15); int t = 1; // std::cin >> t; while (t--) nono::solve(); }