import sys
sys.stdin=open("input.txt","rt")
n,m = map(int,input().split())
# n = int(input())
arr = list(map(int,input().split()))
# n = input()
# cnt = 0
# 하나하나 전부 구하게 됨
# for i in range(n):
# sum = 0
# for j in range(i,n):
# sum += arr[j]
# if sum == m:
# cnt +=1
# break
# if sum > m:
# break
cnt = 0
tot = 0
rt = 0
lt = 0
while True:
if tot < m:
if rt <n:
tot += arr[rt]
rt +=1
else:
break
elif tot == m:
cnt+=1
tot -= arr[lt]
lt +=1
else:
tot -= arr[lt]
lt+=1
print(cnt)
N개의 수로 된 수열 A[1], A[2], …, A[N] 이 있다. 이 수열의 i번째 수부터 j번째 수까지의 합 A[i]+A[i+1]+…+A[j-1]+A[j]가 M이 되는 경우의 수를 구하는 프로그램을 작성하시오.