input_lines = input().split()
N = int(input_lines[0])
x = int(input_lines[1])
input_lines = input().split()
list_a = []
for i in range(N):
    list_a.append(int(input_lines[i]))

max = 0
for i in range(N):
    current_candy = x
    current_child = 0
    for j in range(i,N):
        tmp = current_candy - list_a[j]
        if tmp >= 0:
            current_candy = tmp
            current_child += 1
    if tmp > 0:
        current_child -= 1
    if current_child >= max:
        max = current_child

print(max)
