#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; typedef long long LL; typedef unsigned long long ULL; #define MEM(a,b) memset((a),(b),sizeof(a)) const LL INF = 1e9 + 7; const int N = 1e5 + 10; const int M = 1e5 + 10; int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); int n, k; scanf("%d%d", &n, &k); vector v(n); for (auto& x : v) scanf("%d", &x); sort(v.begin(), v.end()); int ans = 0; for (auto& x : v) { if (k < x) break; ans++; k -= x; } printf("%d %d\n", ans, k); return 0; }