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