#include <bits/stdc++.h>
using namespace std;
int a[101];
set<char> b;
string k;
int main() {
  int sum = 0, ans = 0;
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    if (a[i] > sum) {
      sum = m;
      ans++;
      while (a[i] > sum) {
        sum += m;
        ans++;
      }
      sum -= a[i];
    } else
      sum -= a[i];
  }
  cout << ans;
}
