#include #include #include using namespace std; using ll = long long; //156 int main() { int n, m, c[11] = { 0 }; scanf("%d %d", &n, &m); for (int i = 0; i < n; i++) scanf("%d", c + i); sort(c, c + n); int blank = 0, ped = 0; while (c[blank] + ped <= m && blank < n) ped += c[blank++]; printf("%d\n", blank); }