import java.util.Scanner; public class yukicoder_156 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int n = stdIn.nextInt(); int m = stdIn.nextInt(); int[] box = new int[n]; for (int i = 0; i < n; i++) { box[i] = stdIn.nextInt(); } for (int i = 1; i <= box.length; i++) { for (int j = 0; j < box.length - 1; j++) { if (box[j] > box[j+1]) { int t; t = box[j]; box[j] = box[j+1]; box[j+1] = t; } } } int candy = 0, i = 0; for(i = 0; i < box.length; i++) { candy += box[i]; if (candy > m) { break; } } System.out.println(i); } }