import std.stdio, std.string, std.conv, std.algorithm, std.numeric; import std.range, std.array, std.math, std.typecons, std.container, core.bitop; void main() { int L = readln.chomp.to!int; readln; readln.split.to!(int[]).sort().cumulativeFold!"a+b".filter!(x => x<=L).count.writeln; }