#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#pragma GCC optimize("Os")
using namespace std;
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t, n, k, i, sum = 0;
  cin >> n >> k;
  long long arr[n];
  for (i = 0; i < n; i++) cin >> arr[i];
  if (n == 1) {
    cout << (arr[0] + k - 1) / k;
    return 0;
  }
  sum += arr[0] / k;
  long long r = arr[0] % k;
  for (i = 1; i < n - 1; i++) {
    if (r + arr[i] <= k) {
      if (r != 0)
        sum++, r = 0;
      else
        r = arr[i];
    } else {
      sum += (arr[i] + r) / k;
      r = (arr[i] + r) % k;
    }
  }
  sum += (arr[n - 1] + r + k - 1) / k;
  cout << sum;
  return 0;
}
