n, m = map(int, input().split())

a = list(map(int, input().split()))

res = 0
sum = 0
can = True

for i in range(n):
    if can is False:
        # print('cc', sum)
        sum = sum + a[i]
        if sum is not 0:
            res = res + max(1, sum // m)
        sum = sum % m
        can = True
    else:
        sum = sum + a[i]
        # print('ff', sum)
        if sum >= m:
            res = res + sum // m
            sum = sum % m
            can = True
        else:
            # print('dd', sum)
            can = False
if sum > 0:
    res = res + 1
print(res)