package m.shin; import java.util.Arrays; import java.util.Scanner; public class Con156 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = s.nextInt() , M = s.nextInt(); int[] C = new int[N]; for(int i = 0;i < N;i++){ C[i] = s.nextInt(); } s.close(); Arrays.sort(C); for(int i = 0;i < N;i++){ M -= C[i]; if(M < 0){ System.out.println(i); break; }else if(i == N-1){ System.out.println(i+1); } } } }