using System; using System.Linq; using System.Collections.Generic; class Program { static void Main(string[] args) { string[] str = Console.ReadLine().Split(); int n = int.Parse(str[0]); int m = int.Parse(str[1]); int[] c = Console.ReadLine().Split().Select(xx => int.Parse(xx)).ToArray(); Array.Sort(c); int i = 0; while (m != 0 && i < n) { if (m >= c[i]) { m -= c[i]; c[i] = 0; } else { c[i] -= m; m = 0; } i++; } int box = Array.LastIndexOf(c, 0) + 1; Console.WriteLine(box); Console.Read(); } }