L = int(input()) N = int(input()) W = list(map(int, input().split())) sum = 0 count = 0 W.sort() for i in W: if sum + i <= 100: sum += i count += 1 else: print(count) break