#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const int MOD = 1e9 + 7; using ld = long double; using ll = long long; using ull = unsigned long long; template using pq = priority_queue; template using pqg = priority_queue, greater>; template inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return 1; } return 0; } template inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return 1; } return 0; } template auto min(const T &a) { *min_elemenet(all(a)); } template auto max(const T &a) { *max_elemenet(all(a)); } // const ll MOD = 1e9 + 7; const ll INF = 1 << 30; const ll INFLL = 1LL << 60; const ld EPS = 1e-9; const ll dx[] = {0, 1, 0, -1, 1, -1, 1, -1}; const ll dy[] = {1, 0, -1, 0, 1, -1, -1, 1}; #define all(v) begin(v), end(v) struct mint { ull a; constexpr mint(const ull x = 0) noexcept : a(x % MOD) {} constexpr mint operator+(const mint rhs) const noexcept { return mint(*this) += rhs; } constexpr mint operator-(const mint rhs) const noexcept { return mint(*this) -= rhs; } constexpr mint operator*(const mint rhs) const noexcept { return mint(*this) *= rhs; } constexpr mint operator/(const mint rhs) const noexcept { return mint(*this) /= rhs; } constexpr mint &operator+=(const mint rhs) noexcept { a += rhs.a; if (a >= MOD) a -= MOD; return *this; } constexpr mint &operator-=(const mint rhs) noexcept { if (a < rhs.a) a += MOD; a -= rhs.a; return *this; } constexpr mint &operator*=(const mint rhs) noexcept { a = a * rhs.a % MOD; return *this; } constexpr mint &operator/=(mint rhs) noexcept { ull exp = MOD - 2; while (exp) { if (exp % 2) *this *= rhs; rhs *= rhs; exp /= 2; } return *this; } constexpr mint pow(const mint &a, ull n) noexcept { if (n <= 0) return 1; auto t = pow(a, n / 2); t = t * t; if (n & 1) t = t * a; return t; } }; long long modpow(long long a, long long n, long long m = MOD) { if (n <= 0) return 1LL; if (n % 2LL) return a * modpow(a, n - 1) % MOD; long long t = modpow(a, n / 2); return t % MOD * t % MOD; } struct Combination { const int MAX = 2e5 + 5; vector fact, invfact; Combination() { fact.resize(MAX); invfact.resize(MAX); fact[0] = 1; for (int i = 1; i < MAX; ++i) { fact[i] = fact[i - 1] * i % MOD; } invfact[MAX - 1] = modpow(fact[MAX - 1], MOD - 2); for (int i = MAX - 1; i > 0; --i) { invfact[i - 1] = invfact[i] * i % MOD; } } long long nCr(int n, int r) { long long a = fact[n]; long long b = invfact[r] * invfact[n - r] % MOD; return a * b % MOD; } }; struct UnionFind { int n; vector parent, siz; UnionFind(int n) : n(n) { parent.resize(n); siz.resize(n); for (int i = 0; i < n; ++i) { parent[i] = i; siz[i] = 1; } } int root(int x) { if (parent[x] == x) return x; return parent[x] = root(parent[x]); } bool unite(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (siz[x] < siz[y]) swap(x, y); parent[y] = x; siz[x] += siz[y]; return true; } int same(int x, int y) { return root(x) == root(y); } int size(int x) { return siz[root(x)]; } }; struct RollingHash { int n; vector HS; vector mp; const ull b = 3491; RollingHash(string &S) { n = S.size(); mp.assign(n, 0); HS.assign(n + 1, 0); for (int i = 0; i < n; ++i) { mp[i] = modpow(b, i); } for (int i = 0; i < n; ++i) { HS[i + 1] = HS[i] + mp[n - i - 1] * (S[i] - '0') % MOD; HS[i + 1] %= MOD; } } int getHash(int l, int r) { if (r > n) return -1; return (HS[r] - HS[l] + MOD) % MOD; } int getHash(string &T) { if (T.size() > n) return -1; int m = T.size(); int ret = 0; for (int i = 0; i < m; ++i) { ret += mp[m - i - 1] * (T[i] - '0') % MOD; ret %= MOD; } return ret; } bool isSubstr(string &T) { int m = T.size(); if (m > n) return false; int ht = getHash(T); vector u; for (int i = n - m; i >= 0; --i) { int hs = getHash(i, i + m); if (hs == ht) u.push_back(i); ht *= b; ht %= MOD; } for (int i = 0; i < u.size(); ++i) { cout << u[u.size() - i - 1] << endl; } return false; } }; int main(void) { ll n, k; cin >> n >> k; if (n == k && n == 1) { cout << 1 << " " << 0 << endl; return 0; } vector a(n); for (int i = 0; i < n; ++i) cin >> a[i]; sort(all(a)); ll sum = 0; for (int i = 0; i < n; ++i) { sum += a[i]; if (sum >= k) { cout << i << " " << k - (sum - a[i]) << endl; return 0; } } return 0; }