#include <bits/stdc++.h>
using namespace std;
const long long maxn = 3e5 + 1;
const long long inf = 1e18 + 7;
long long n, m, i, a, cur, ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  cur = m;
  ans = 0;
  for (i = 0; i < n; i++) {
    cin >> a;
    if (cur >= a)
      cur -= a;
    else {
      cur = m - a;
      ans++;
    }
  }
  if (cur < m) ans++;
  cout << ans;
  return 0;
}
