import java.util.Arrays; import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(); int[] t = new int[n]; for(int i = 0; i < n; i++){ t[i] = sc.nextInt(); } Arrays.sort(t); for(int i = 0; i < n; i++){ m -= t[i]; if(m < 0){ System.out.println(i); return; } } System.out.println(n); } }