N, M = map(int, input().split()) C = list(map(int, input().split())) ans = 0 for c in C: M = M - c if M >= 0: ans += 1 print(ans)