using System; namespace yukicoder { class Program { static void Main(string[] args) { string[] s = Console.ReadLine().Split(' '); string[] s1 = Console.ReadLine().Split(' '); int a = int.Parse(s[0]); int b = int.Parse(s[1]); int[] c = new int[a]; int count = 0; for(int x = 0; x < a; x++) { c[x] = int.Parse(s1[x]); } Array.Sort(c); for (int i = 0; i < a; i++) { if ( b-c[i]>=0 ) { b = b - c[i]; count++; } if (b < 0) { break; } } Console.WriteLine(count); } } }