#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, m, t, s, a[15000] = {0};
cin >> n >> m;
s = 0;
for (int q = 0 ; q < n ; q++) {
cin >> a[q];
}
for (int q = 0 ; q < n ; q++) {
t = 0;
for (int w = q ; w < n ; w++) {
t += a[w];
if (t == m) {
t -= a[w];
s++;
if (t == 0) {
break;
}
continue;
}
if (t > m) {
t -= a[w];
continue;
}
}
}
cout << s;
return 0;
}