

def compute():
    # Strategy, getting rid when number reach capacity, and on last day throw everything
    bag = 0
    dum = input().split()
    n,k = int(dum[0]),int(dum[1])
    dum = input().split()
    remain = [0,0] # to stock the different rmainings
    for i in range(n):
        cur = int(dum[i]) + remain[0] + remain[1]
        usage = cur//k

        if i == n-1:
            usage = cur//k
            return bag + usage + cur-usage*k


        remain[0], remain[1] = remain[1],0
        remain[1] = cur - usage * k - remain[0]
        if usage * k > remain[0]:
            remain[0] = 0
        elif usage*k < remain[0]:
            bag += 1
            remain[0] = 0
   #     print(bag)
        bag += usage

if __name__ == '__main__':
    print(compute())