import std.stdio, std.algorithm, std.array, std.conv, std.string; void main() { auto nm = readln().split().map!(to!long); auto c = readln().split.map!(to!long).array.sort!"a < b"; long cnt = 0; long m = nm[1]; foreach(ci; c) { if (m - ci < 0) { break; } else if (m - ci == 0) { cnt++; break; } cnt++; m -= ci; } writeln(cnt); }