import std.stdio, std.conv, std.string, std.range, std.math, std.algorithm; void main() { auto input = readln.split.to!(int[]); auto N = input[0], M = input[1]; auto C = readln.split.to!(int[]); C.sort; foreach (ref e; C) { if (M == 0) break; auto tmp = min(e, M); e -= tmp; M -= tmp; } C.count!"a==0".writeln; }