import math

def findMinBags(n, capacity, garbages):
    bags = 0
    must_bag = 0
    remaining_space = 0
    for garb in garbages:
        if must_bag:
            remaining_space = capacity - (must_bag % capacity)
            bags += math.ceil(must_bag / capacity)
        if garb >= remaining_space:
            garb -= remaining_space
            must_bag = garb % capacity
            bags += garb // capacity
        else:
            must_bag = 0
        remaining_space = 0
    if must_bag: bags += 1
    return bags


n, capacity = [int(x) for x in input().split(' ')]
garbages = [int(x) for x in input().split(' ')]
print(findMinBags(n, capacity, garbages))
 	  	       	   		   		   	 			