#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m, i, j, sum = 0, pre = 0;
  cin >> n >> m;
  long long ar[n];
  for (i = 0; i < n; i++) cin >> ar[i];
  sum = 0;
  sum += (ar[0] / m);
  pre = ar[0] % m;
  for (i = 1; i < n; i++) {
    if (ar[i] + pre == 0) continue;
    if (pre + ar[i] <= m) {
      sum++;
      pre = 0;
      continue;
    }
    ar[i] -= (m - pre);
    sum++;
    sum += (ar[i] / m);
    pre = ar[i] % m;
  }
  cout << sum << endl;
  return 0;
}
