#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000005;
long long num1[maxn], num2[maxn];
int main() {
  int n, m, sum = 0, t, ans = 1;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    if (sum + t > m) {
      ans++;
      sum = t;
    } else
      sum += t;
  }
  printf("%d\n", ans);
  return 0;
}
