n,k=map(int,input().split())
ar=list(map(int,input().split()))
if(n>1):
    count=0
    left=0
    count+=(ar[0])//k
    left=(ar[0])%k    
    for i in range(1,n-1):
        if(left+ar[i]<=k):
            if(left!=0 and ar[i]!=0):
                left=0
                count+=1
            elif(left!=0 and ar[i]==0):
                left=0
                count+=1
            elif(left==0 and ar[i]==0):
                left=0
            elif(left==0 and ar[i]!=0):
                left=ar[i]
        else:
            count+=(left+ar[i])//k
            left=(left+ar[i])%k
    if((ar[-1]+left)%k==0):
        count+=(ar[-1]+left)//k
    else:
        count+=(ar[-1]+left)//k+1
else:
    if(ar[0]%k==0):
        count=ar[0]//k
    else:
        count=ar[0]//k+1
print(count)