import java.util.Scanner; import java.util.Arrays; public class Main{ public static void main(String[] args) { Scanner sc1 = new Scanner(System.in); int n = Integer.parseInt(sc1.next()); Scanner sc2 = new Scanner(System.in); int m = Integer.parseInt(sc2.next()); Scanner sc3 = new Scanner(System.in); int[] arr = Arrays.stream(sc3.nextLine().split(" ")) .mapToInt(Integer::parseInt) .toArray(); Arrays.sort(arr); int j = 0; int m1 = m; for(int i = 0; j <= n; i++) { j += arr[i]; m--; if(m == 0) { break; } } System.out.println(m1-m); } }