import math
if __name__ == "__main__":
 days,cap = list(map(int,input().split()))
 bin = list(map(int,input().split()))
 bags1 = []
 bags2 = []
 for i in range(0,days):
  if bin[i]%cap == 0:
   bags1.append(bin[i]//cap)
 
 for i in range(0,days-1):
  if bin[i]%cap !=0 and bin[i+1] !=0:
   bags2.append(math.ceil(bin[i]/cap))
   bin[i+1] = abs(bin[i+1] - abs(bin[i]-cap))
  if bin[i]%cap !=0 and bin[i+1] ==0:
   bags2.append(math.ceil(bin[i]/cap))
 print(max(sum(bags1),sum(bags2)))
