#ifndef hari64 #include // #pragma GCC target("avx2") // #pragma GCC optimize("O3") // #pragma GCC optimize("unroll-loops") #define debug(...) #else #include "util/viewer.hpp" #define debug(...) viewer::_debug(__LINE__, #__VA_ARGS__, __VA_ARGS__) #endif // clang-format off using namespace std; template using vc = vector; template using vvc = vector>; template using vvvc = vector>; using ll = long long; using ld = long double; using pii = pair; using pll = pair; using tiii = tuple; using tlll = tuple; using vi = vc; using vvi = vvc; using vvvi = vvvc; using vll = vc; using vvll = vvc; using vvvll = vvvc; using vb = vc; using vvb = vvc; using vvvb = vvvc; using vpii = vc; using vvpii = vvc; using vpll = vc; using vvpll = vvc; using vtiii = vc; using vvtiii = vvc; using vtlll = vc; using vvtlll = vvc; #define ALL(x) begin(x), end(x) #define RALL(x) (x).rbegin(), (x).rend() constexpr int INF = 1001001001; constexpr long long INFll = 1001001001001001001; template bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } template bool chmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; } // clang-format on int main() { cin.tie(0); ios::sync_with_stdio(false); int N, K; cin >> N >> K; vector As(N); for (int i = 0; i < N; i++) { cin >> As[i]; } sort(ALL(As)); int cnt = 0; for (int i = 0; i < N; i++) { if (K >= As[i]) { K -= As[i]; cnt++; } else { break; } } cout << cnt << endl; cout << K << endl; return 0; }