#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
typedef long long ll;
const int maxn = 1000005;
int a[200];
int main() {
  int n, m, i, sum, x, t;
  scanf("%d%d", &n, &m);
  sum = 0;
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  t = 0;
  for (i = 1; i <= n; i++) {
    if (t + a[i] <= m)
      t += a[i];
    else {
      sum++;
      t = a[i];
    }
  }
  if (t <= m) sum++;
  printf("%d\n", sum);
  return 0;
}
