#!/usr/bin/env python3

import collections
import sys
import traceback

class Input(object):
    def __init__(self):
        self.fh = sys.stdin

    def next_line(self):
        while True:
            line = sys.stdin.readline()
            if line == '\n':
                continue
            return line


    def next_line_ints(self):
        line = self.next_line()
        return [int(x) for x in line.split()]

    def next_line_strs(self):
        line = self.next_line()
        return line.split()


def get_min_bags(n, k, s):
    bags = 0
    left = 0
    for i in range(n):
        if left == 0:
            bags += s[i] // k
            left = s[i] % k
        elif left + s[i] < k:
            bags += 1
            left = 0
        else:
            bags += (left + s[i]) // k
            left = (left + s[i]) % k
    bags += (left + k - 1) // k
    return bags


def main():
    input = Input()
    while True:
        try:
            nums = input.next_line_ints()
            if not nums:
                break
            n, k = nums
            if n == -1:
                break
            s = input.next_line_ints()
        except:
            print('read input failed')
        try:
            min_bags = get_min_bags(n, k, s)
            print("{}".format(min_bags))
        except:
            traceback.print_exc(file=sys.stdout)
            print('get_min_dist failed')

main()