#include <bits/stdc++.h>
int main() {
  int n, m, temp, array[105], count;
  double sum;
  while (scanf("%d%d", &n, &m) != -1) {
    count = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &array[i]);
    }
    for (int i = 0; i < n; i++) {
      count++;
      sum = array[i];
      while (i + 1 < n) {
        if (sum == m) {
          break;
        }
        i++;
        if (sum + array[i] > m) {
          i--;
          break;
        } else {
          sum += array[i];
        }
      }
    }
    printf("%d\n", count);
  }
  return 0;
}
