def solve(l, n, k):
    ans = s = i = j = 0
    while i < n:
        if s < k:
            if j < n:
                s += l[j]
                j += 1
            else:
                break
        else:
            if s == k:
                ans = max(ans, j - i)
            s -= l[i]
            i += 1
    return ans

n, k = map(int, input().split())
l = list(map(int, input().split()))
print(solve(l, n, k))