import java.util.LinkedList; class A { int want; LinkedList have = new LinkedList(); A(int i) { this.want = i; } } public class No_156 { public static void main(String[] args) { java.util.Scanner sc = new java.util.Scanner(System.in); int n = sc.nextInt(); LinkedList box = new LinkedList(); A a = new A(sc.nextInt()); for (int i = 0; i < n; i++) { box.add(sc.nextInt()); } java.util.Collections.sort(box); while (a.want > 0) { int x = box.poll(); a.want -= x; if (a.want >= 0) { a.have.add(x); } } System.out.println(a.have.size()); sc.close(); } }