import numpy as np
N, x = map(int, input().split())
a = np.array(list(map(int, input().split())))
a.sort()
np.cumsum(a, out=a)
b = (a <= x)
k = b.argmin()
c = b.sum() - (a[k-1] != x) + 1 - b.any()
print(c)