# Arup Guha
# 7/15/2025
# Solution to CSES Problem: Subarray Sums I
# https://cses.fi/problemset/task/1660/

# Get basic input.
toks = input().split()
n = int(toks[0])
target = int(toks[1])

# Get list.
vals = [int(x) for x in input().split()]

# Initialize these.
i = 0
j = 0
curS = 0
res = 0

# Go until no more subarrays.
while i < n:

    # Sum is too small and there's more numbers to add to right end.
    if j < n and curS < target:
        curS += vals[j]
        j+=1

    # Sum is too big, we can subtract out the left end.
    elif curS > target:
        curS -= vals[i]
        i+=1

    # Sum is correct, add it in!
    elif curS == target:
        res += 1
        curS -= vals[i]
        i+=1

    # If we get here, we must move our left pointer forward.
    else:
        curS -= vals[i]
        i+=1

# Ta da!
print(res)

    
