#include <iostream>
#include <algorithm>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int N, M, add = 0, temp, sum = 0;
cin >> N >> M;
while (cin >> temp){
add += temp;
if(add > M){
sum++;
add = temp;
}
}
if (add != 0){
sum++;
}
cout << sum;
return 0;
}