N, M = map(int, input().split()) C = list(map(int, input().split())) C.sort() l = len(C) for i in range(l): M -= C[i] if (M <= 0): break else: C[i] = 0 empty_box = 0 for c in C: if (c == 0): empty_box += 1 print(empty_box)