#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)2e5 + 10;
long long n, m, cnt, Remain;
long long a[maxn];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    a[i] += Remain;
    if (i == n) {
      cnt += (a[i] + m - 1) / m;
      break;
    }
    if (a[i] >= m) {
      cnt += a[i] / m;
      Remain = a[i] % m;
    } else if (Remain)
      cnt++, Remain = 0;
    else if (!Remain)
      Remain = a[i];
  }
  cout << cnt << endl;
  return 0;
}
