import java.util.Arrays; import java.util.Scanner; public class No156 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); int C[] = new int[N]; for(int i = 0;i < N;i++) { C[i] = sc.nextInt(); } Arrays.sort(C); int sum = 0; int x = 0; while(true) { sum += C[x]; if(sum >= M) { if(sum == M) { x++; } break; } x++; } System.out.println(x); } }