arr = [1,2,3,2,5]
M = 5
n = len(arr)
start = 0
sum = 0
count = 0
for end in range(n):
sum += arr[end]
while sum > M:
sum -= arr[start]
start += 1
if sum == M:
count += 1
print(count)
To embed this project on your website, copy the following code and paste it into your website's HTML: