/* -*- coding: utf-8 -*- * * 2424.cc: No.2424 Josouzai - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 200000; /* typedef */ /* global variables */ int as[MAX_N]; /* subroutines */ /* main */ int main() { int n, k; scanf("%d%d", &n, &k); for (int i = 0; i < n; i++) scanf("%d", as + i); sort(as, as + n); int c = 0; for (int i = 0; i < n && k >= as[i]; i++) c++, k -= as[i]; printf("%d %d\n", c, k); return 0; }