#include <bits/stdc++.h>
int main() {
  long long n, m, a[10000], i, x, y, z;
  printf("输入：\n");
  while (~scanf("%lld %lld", &n, &m)) {
    x = 0;
    y = 0;
    for (i = 0; i < n; i++) scanf("%lld", &a[i]);
    if (n == 1) {
      if (a[0] % m == 0)
        x = a[0] / m;
      else
        x = a[0] / m + 1;
    } else {
      for (i = 0; i < n; i++) {
        a[i] = a[i] + y;
        if (i == n - 1) {
          if (a[n - 1] >= m && a[n - 1] % m == 0)
            x = x + a[n - 1] / m;
          else if (a[n - 1] < m && a[n - 1] > 0)
            x += 1;
          else if (a[n - 1] >= m && a[n - 1] % m != 0)
            x = x + a[n - 1] / m + 1;
          break;
        }
        if (a[i] >= m) {
          x += a[i] / m;
          y = a[i] % m;
        } else {
          y = a[i];
          if (a[i + 1] + y < m && a[i + 1] + y > 0) {
            x++;
            y = 0;
            i++;
          }
        }
      }
    }
    printf("输出：\n");
    printf("%lld", x);
  }
  return 0;
}
