#include <bits/stdc++.h>
using namespace std;
int main() {
  long long m, n, arr[10000], i, sum = 0, ans, x, j;
  cin >> m >> n;
  for (i = 0; i < m; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  i = 0;
  while (1) {
    if (sum == 0) break;
    x = n;
    for (j = 0; j < m; j++) {
      if (x - arr[j] >= 0) {
        x = x - arr[j];
        sum = sum - arr[j];
        arr[j] = 0;
      } else
        break;
    }
    i++;
  }
  printf("%lld\n", i);
}
