Enough is enough. Too many times it happened that Vasya forgot to dispose of garbage and his apartment stank afterwards. Now he wants to create a garbage disposal plan and stick to it.

For each of next $n$ days Vasya knows $a_i$ — number of units of garbage he will produce on the $i$-th day. Each unit of garbage must be disposed of either on the day it was produced or on the next day. Vasya disposes of garbage by putting it inside a bag and dropping the bag into a garbage container. Each bag can contain up to $k$ units of garbage. It is allowed to compose and drop multiple bags into a garbage container in a single day.

Being economical, Vasya wants to use as few bags as possible. You are to compute the minimum number of bags Vasya needs to dispose of all of his garbage for the given $n$ days. No garbage should be left after the $n$-th day.


-----Input-----

The first line of the input contains two integers $n$ and $k$ ($1 \le n \le 2\cdot10^5, 1 \le k \le 10^9$) — number of days to consider and bag's capacity. The second line contains $n$ space separated integers $a_i$ ($0 \le a_i \le 10^9$) — the number of units of garbage produced on the $i$-th day.


-----Output-----

Output a single integer — the minimum number of bags Vasya needs to dispose of all garbage. Each unit of garbage should be disposed on the day it was produced or on the next day. No garbage can be left after the $n$-th day. In a day it is allowed to compose and drop multiple bags.


-----Examples-----
Input
3 2
3 2 1

Output
3

Input
5 1
1000000000 1000000000 1000000000 1000000000 1000000000

Output
5000000000

Input
3 2
1 0 1

Output
2

Input
4 4
2 8 4 1

Output
4

Source: codeforces | Difficulty: EASY
Tags: Greedy algorithms


Solutions:
(n, k) = map(int, input().split())
nums = list(map(int, input().split()))
result = 0
remain = 0
for num in nums:
	if not (num + remain) // k and remain:
		result += 1
		remain = 0
		continue
	result += (num + remain) // k
	remain = (num + remain) % k
if remain:
	result += 1
print(result)


(n, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
prev = 0
bags = 0
for i in range(n):
	if (arr[i] + prev) // k == 0:
		if prev > 0:
			bags += 1
			prev = 0
		else:
			prev = arr[i]
	else:
		bags += (arr[i] + prev) // k
		prev = (arr[i] + prev) % k
if prev != 0:
	bags += 1
print(bags)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
flag = [False]
sum = 0
for i in range(n):
	sum += l[i] // k
	if i < n - 1:
		if flag[i] == True and l[i] // k == 0:
			sum += 1
			flag.append(False)
		else:
			l[i + 1] += l[i] % k
			if l[i] % k != 0:
				flag.append(True)
			else:
				flag.append(False)
	elif l[i] % k != 0:
		sum += 1
print(sum)


from math import ceil
(n, k) = map(int, input().split())
a = [0] + list(map(int, input().split()))
last = 0
bags = 0
for i in range(n + 1):
	if i == n:
		last += a[i]
		bags += ceil(last / k)
	else:
		b = ceil(last / k)
		bags += b
		l = b * k - last
		last = a[i] - min(a[i], l)
print(bags)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for i in range(1, n):
	ans += A[i - 1] // k
	if A[i - 1] % k:
		ans += 1
		A[i] = max(0, A[i] - (k - A[i - 1] % k))
if A[n - 1] > 0:
	ans += A[n - 1] // k
	if A[n - 1] % k:
		ans += 1
print(ans)


from sys import stdin, stdout
from math import sqrt
import math
import heapq
from itertools import accumulate
(N, K) = [int(x) for x in stdin.readline().split()]
arr = [int(x) for x in stdin.readline().split()]
last = 0
res = 0
for i in range(N):
	if last % K != 0:
		d = K - last % K
		remove = min(arr[i], d)
		last += remove
		arr[i] -= remove
	res += last // K + 1 * (last % K != 0)
	res += arr[i] // K
	last = arr[i] % K
res += last // K + 1 * (last % K != 0)
print(res)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split())) + [0]
ans = 0
r = 0
for i in range(n - 1, -1, -1):
	s = a[i]
	s = max(0, a[i] - r)
	x = (s + k - 1) // k
	ans += x
	r = x * k - s
print(ans)


from math import ceil, floor

def main():
	(n, k) = list(map(int, input().split(' ')))
	li = list(map(int, input().split(' ')))
	ans = 0
	b = False
	for i in range(n):
		if i != n - 1:
			if li[i + 1] == 0:
				ans += ceil(li[i] / k)
			elif b == True:
				ans += ceil(li[i] / k)
				b = False
			else:
				if (li[i + 1] + li[i] % k) % k > li[i + 1]:
					b = True
				ans += floor(li[i] / k)
				li[i + 1] += li[i] % k
		else:
			ans += ceil(li[i] / k)
	print(ans)
main()


(n, k) = list(map(int, input().split()))
a = [int(x) for x in input().split()]
bag = a[0] // k
remain = a[0] % k
for i in range(1, n):
	tk = a[i] + remain
	remain = tk % k
	if remain > a[i]:
		bag += 1
		remain = 0
	else:
		bag += tk // k
if remain == 0:
	print(bag)
else:
	print(bag + 1)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
s = 0
for i in range(n - 1):
	x = l[i]
	s += x // k
	if x % k > 0:
		l[i + 1] += x % k
		if 0 < l[i + 1] < k:
			l[i + 1] = 0
			s += 1
s += l[-1] // k + (l[-1] / k != l[-1] // k)
print(s)


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
(n, k) = f()
l = [0] + il() + [0]
ans = 0
x = 0
for i in range(1, n + 2):
	ans += (l[i - 1] + l[i]) // k
	if l[i] >= (l[i - 1] + l[i]) % k:
		l[i] = (l[i - 1] + l[i]) % k
	else:
		ans += 1
		l[i] = max(0, l[i] - k + l[i - 1])
print(ans)


(a, b) = map(int, input().split())
s = 0
p = 0
y = 0
for i in map(int, input().split()):
	if p:
		if p + i >= b:
			k = i + p
			p = 0
			r = k // b
			s += r
			p = k - r * b
		else:
			s += 1
			p = 0
	else:
		k = i // b
		s += k
		p = i - k * b
print(s + (p != 0))


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
prev = 0
c = 0
for i in range(n):
	ans += (prev + a[i]) // k
	prev = (prev + a[i]) % k
	if prev > a[i]:
		if prev % k == 0:
			ans += prev // k
		else:
			ans += prev // k + 1
		prev = 0
if prev > 0:
	ans += 1
print(ans)


import math
(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
curr_dump = 0
prev_dump = 0
n_disposal = 0
for i in range(n):
	curr_dump = a[i]
	if prev_dump + curr_dump < k:
		if prev_dump > 0:
			n_disposal += 1
			prev_dump = 0
		elif prev_dump == 0:
			prev_dump = curr_dump
	else:
		n_disposal += int((prev_dump + curr_dump) / k)
		prev_dump = (prev_dump + curr_dump) % k
n_disposal += math.ceil(prev_dump / k)
print(n_disposal)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
total_days = 0
sum1 = 0
bag = 0
for i in range(len(a)):
	total_days = (sum1 + a[i]) // k
	if total_days == 0 and sum1 > 0:
		sum1 = 0
		total_days += 1
	else:
		sum1 = (sum1 + a[i]) % k
	bag += total_days
if sum1 > 0:
	bag += 1
print(bag)


(n, k) = map(int, input().strip().split())
garbage = []
garbage[:] = list(map(int, input().strip().split()))
total = 0
addi = 0
addiFlag = False
for day in range(n):
	if addiFlag:
		addiFlag = False
		if addi + garbage[day] > k:
			garbage[day] -= k - addi
			addi = 0
			total += 1
		else:
			addi = 0
			garbage[day] = 0
			total += 1
	total += (garbage[day] + addi) // k
	addi = garbage[day] % k
	if addi > 0:
		addiFlag = True
	if day == n - 1:
		if addi > 0:
			total += 1
print(total)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
ans = 0
pre = 0
for i in range(n):
	if pre != 0:
		ans += 1
		a[i] -= k - pre
		if a[i] < 0:
			a[i] = 0
	ans += a[i] // k
	pre = a[i] - a[i] // k * k
if pre != 0:
	ans += 1
print(ans)


(n, k) = list(map(int, input().split()))
days = list(map(int, input().split()))
nb_bags = 0
crt_cap = 0
for i in range(n):
	if crt_cap != 0:
		days[i] = max(days[i] - (k - crt_cap), 0)
		crt_cap = 0
		nb_bags += 1
	nb_bags += int(days[i] / k)
	crt_cap = days[i] % k
if crt_cap != 0:
	nb_bags += 1
print(nb_bags)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
res = 0
sum = 0
can = True
for i in range(n):
	if sum > 0:
		sum = sum + a[i]
		if sum < m:
			res = res + 1
			sum = 0
		else:
			res = res + sum // m
			sum = sum % m
	else:
		sum = sum + a[i]
		res = res + sum // m
		sum = sum % m
if sum > 0:
	res = res + 1
print(res)


(n, k) = map(int, input().split())
l = [*map(int, input().split())]
c = 0
res = 0
for (i, val) in enumerate(l):
	if val + c < k and c > 0:
		res += int(val + c > 0)
		c = 0
	else:
		res += (val + c) // k
		c = (val + c) % k
if c > 0:
	res += 1
print(res)


v = []
(n, k) = list(map(int, input().split()))
s = 0
v = [int(x) for x in input().split()]
q = 0
carry = 0
for i in range(len(v)):
	prev_carry = carry
	garbage = v[i] + carry
	boxes = garbage // k
	carry = garbage % k
	if i > 0 and boxes == 0 and (carry > 0) and (prev_carry > 0):
		carry = 0
		boxes = 1
	q += boxes
if carry > 0:
	q += 1
print(q)


(n, k) = tuple((int(_) for _ in input().split()))
a = tuple((int(_) for _ in input().split()))
(total_bags, c) = (0, 1)
pre = a[0]
while c < len(a):
	b = a[c]
	if c == len(a) - 1:
		total_bags += int((pre + b) / k)
		if (pre + b) % k != 0:
			total_bags += 1
	elif pre % k == 0:
		total_bags += int(pre / k)
		pre = b
	else:
		total_bags += int(pre / k) + 1
		pre = max(0, b - k + pre % k)
	c += 1
if len(a) == 1:
	total_bags = int(a[0] / k)
	if a[0] % k != 0:
		total_bags += 1
print(int(total_bags))


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
p = 0
cp = 0
sdg = 0
fdg = 0
tg = 0
fplp = 0
for d in range(n - 1):
	fdg = a[d]
	cp = sdg // k + (0 if sdg % k == 0 else 1)
	fplp = k - sdg % k
	if fplp == k:
		fplp = 0
	fdg -= min(fplp, fdg)
	cp += fdg // k
	fdg -= fdg // k * k
	p += cp
	sdg = fdg
fdg = a[n - 1]
p += (sdg + fdg) // k + (0 if (sdg + fdg) % k == 0 else 1)
print(p)


import re
import sys
exit = sys.exit
from bisect import bisect_left as bsl, bisect_right as bsr
from collections import Counter, defaultdict as ddict, deque
from functools import lru_cache
cache = lru_cache(None)
from heapq import *
from itertools import *
from math import inf
from pprint import pprint as pp
enum = enumerate
ri = lambda : int(rln())
ris = lambda : list(map(int, rfs()))
rln = sys.stdin.readline
rl = lambda : rln().rstrip('\n')
rfs = lambda : rln().split()
mod = 1000000007
d4 = [(0, -1), (1, 0), (0, 1), (-1, 0)]
d8 = [(-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1)]
(n, k) = ris()
a = ris()
a.append(0)
ans = 0
garb = 0
for x in a:
	if garb:
		ans += 1
		x -= min(k - garb, x)
	ans += x // k
	garb = x % k
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(ans, tmp) = (0, 0)
for i in range(len(a)):
	ans += (a[i] + tmp) // k
	rem = (a[i] + tmp) % k
	if i == n - 1:
		if rem:
			ans += 1
	elif rem > a[i]:
		tmp = 0
		ans += 1
	else:
		tmp = rem
print(ans)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
(c, x) = (0, 0)
for i in range(n):
	y = (x + a[i]) // k
	if x > 0 and y == 0:
		x = 0
		y += 1
	else:
		x = (x + a[i]) % k
	c += y
if x > 0:
	c += 1
print(c)


from math import ceil
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
r = 0
ans = 0
for i in range(n - 1, -1, -1):
	arr[i] = max(0, arr[i] - r)
	ans += ceil(arr[i] / k)
	if arr[i] % k != 0:
		r = k - arr[i] % k
	else:
		r = 0
print(ans)


import sys
(n, k) = tuple((int(i) for i in sys.stdin.readline().split()))
a = tuple((int(i) for i in sys.stdin.readline().split()))
assert len(a) == n
bags = 0
r = 0
for ai in a:
	leftovers = r > 0
	(q, r) = divmod(ai + r, k)
	if q == 0:
		if leftovers:
			bags += 1
			r = 0
	else:
		bags += q
if r > 0:
	bags += 1
print(bags)


from math import ceil
(n, k) = tuple(map(int, input().split()))
a = list(map(int, input().split()))
s = 0
r = 0
for i in range(n - 1, -1, -1):
	a[i] = max(0, a[i] - r)
	s += int(ceil(a[i] / k))
	if a[i] % k != 0:
		r = k - a[i] % k
	else:
		r = 0
print(s)


from math import ceil

def main():
	(n, k) = (int(x) for x in input().split())
	a = [int(x) for x in input().split()]
	s = a[0] // k
	next = a[0] % k
	if n == 1:
		print(ceil(a[0] / k))
		return 0
	for i in range(1, n - 1):
		if (a[i] + next) % k:
			if a[i] + next < k:
				if next:
					s += 1
					next = 0
				else:
					next = a[i]
			else:
				s += (a[i] + next) // k
				next = (a[i] + next) % k
		else:
			s += (a[i] + next) // k
			next = 0
	s += ceil((a[-1] + next) / k)
	print(s)
main()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(res, ans) = (0, 0)
for i in a:
	res += (ans + i) // k
	if ans + i < k and ans != 0:
		ans = 0
		res += 1
		continue
	ans = (ans + i) % k
print(res + bool(ans))


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
old = 0
current = 0
idx = 0
ans = 0
while idx < len(s):
	if old != 0 and s[idx] // k == 0:
		ans += 1
		old = max(s[idx] - (k - old), 0)
		idx += 1
		continue
	ans += (s[idx] + old) // k
	old = (s[idx] + old) % k
	idx += 1
if old > 0:
	ans += 1
print(ans)


from math import floor
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
i = 0
rem = 0
while i < n:
	if i < n - 1:
		if a[i] + rem <= k and rem != 0:
			ans += 1
			i += 1
			rem = 0
		else:
			ans += floor((a[i] + rem) / k)
			rem = (a[i] + rem) % k
			i += 1
	elif i == n - 1:
		ans += floor((a[i] + rem) / k)
		rem = (a[i] + rem) % k
		i += 1
if rem != 0:
	ans += 1
print(ans)


(n, b) = map(int, input().split())
g = list(map(int, input().split()))
d = 0
left = 0
for i in range(n):
	x = g[i] + left
	if x == 0:
		continue
	elif x < b and left > 0:
		d += 1
		left = 0
	else:
		d += x // b
		left = x % b
if left > 0:
	d += 1
print(d)


import collections
import sys
import traceback

class Input(object):

	def __init__(self):
		self.fh = sys.stdin

	def next_line(self):
		while True:
			line = sys.stdin.readline()
			if line == '\n':
				continue
			return line

	def next_line_ints(self):
		line = self.next_line()
		return [int(x) for x in line.split()]

	def next_line_strs(self):
		line = self.next_line()
		return line.split()

def get_min_bags(n, k, s):
	bags = 0
	left = 0
	for i in range(n):
		if left == 0:
			bags += s[i] // k
			left = s[i] % k
		elif left + s[i] < k:
			bags += 1
			left = 0
		else:
			bags += (left + s[i]) // k
			left = (left + s[i]) % k
	bags += (left + k - 1) // k
	return bags

def main():
	input = Input()
	while True:
		try:
			nums = input.next_line_ints()
			if not nums:
				break
			(n, k) = nums
			if n == -1:
				break
			s = input.next_line_ints()
		except:
			print('read input failed')
		try:
			min_bags = get_min_bags(n, k, s)
			print('{}'.format(min_bags))
		except:
			traceback.print_exc(file=sys.stdout)
			print('get_min_dist failed')
main()


from sys import stdin, stdout
from math import gcd, sqrt
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
N = 10 ** (-6)
(n, k) = R()
flg = False
stk = 0
ans = 0
for i in R():
	stk += i
	mn = 0
	if flg:
		mn = 1
	p = max(mn, stk // k)
	stk -= p * k
	ans += p
	stk = max(0, stk)
	if stk:
		flg = True
	else:
		flg = False
if flg:
	ans += 1
print(ans)


(n, k) = [int(x) for x in input().split()]
lst = [int(x) for x in input().split()]
x = 0
s = 0
ans = 0
for i in range(n):
	if x == 0:
		s += lst[i]
		ans += s // k
		s = s % k
		if s > 0:
			x = 1
	elif x == 1:
		if s + lst[i] < k:
			ans += 1
			s = 0
			x = 0
		else:
			s += lst[i]
			ans += s // k
			s = s % k
			if s > 0:
				x = 1
			else:
				x = 0
if s > 0:
	print(ans + 1)
else:
	print(ans)


(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
elif ar[0] % k == 0:
	count = ar[0] // k
else:
	count = ar[0] // k + 1
print(count)


import os, sys
from io import BytesIO, IOBase

def main():
	(n, m) = rints()
	(a, ans) = (rints(), 0)
	for i in range(n - 1, 0, -1):
		rem = m - a[i] % m
		ans += a[i] // m
		a[i] %= m
		if rem != m:
			if a[i - 1] >= rem:
				ans += 1
				a[i - 1] -= rem
			else:
				ans += ceil1(a[i] + a[i - 1], m)
				a[i - 1] = 0
	ans += ceil1(a[0], m)
	print(ans)

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
BUFSIZE = 8192
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
rstr = lambda : input().strip()
rstrs = lambda : [str(x) for x in input().split()]
rstr_2d = lambda n: [rstr() for _ in range(n)]
rint = lambda : int(input())
rints = lambda : [int(x) for x in input().split()]
rint_2d = lambda n: [rint() for _ in range(n)]
rints_2d = lambda n: [rints() for _ in range(n)]
ceil1 = lambda a, b: (a + b - 1) // b
main()


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
ans = arr[0] // k
val = arr[0] % k
for i in range(1, n):
	if val == 0:
		ans += arr[i] // k
		val = arr[i] % k
	else:
		val += arr[i]
		if val < k:
			val = 0
			ans += 1
		else:
			ans += val // k
			val = val % k
if val != 0:
	ans += 1
print(ans)


(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
res = 0
for i in range(1, n):
	s = a[i - 1] + a[i]
	q = s // k
	res += q
	if q == 0 and a[i - 1] != 0:
		res += 1
		a[i] = 0
	else:
		a[i] = a[i] - (q * k - a[i - 1])
res += (a[n - 1] + k - 1) // k
print(res)


def main():
	(n, k) = map(int, input().split(' '))
	a = list(map(int, input().split(' ')))
	prevstay = 0
	ans = 0
	for i in range(n):
		if prevstay != 0:
			ans += 1
			seats = k - prevstay
			if a[i] >= seats:
				a[i] -= seats
			else:
				a[i] = 0
		ans += a[i] // k
		prevstay = a[i] % k
	if prevstay != 0:
		ans += 1
	print(ans)
	return 0
exit(main())


import sys
input = sys.stdin.readline
l = input().split()
n = int(l[0])
k = int(l[1])
l = input().split()
li = [int(i) for i in l]
curr = 0
haveto = 0
ans = 0
for i in range(n):
	curr += li[i]
	z = max((haveto + k - 1) // k, curr // k)
	curr = max(curr - k * z, 0)
	haveto = curr
	ans += z
ans += (haveto + k - 1) // k
print(ans)


(n, k) = map(int, input().split())
values = list(map(int, input().split()))
bags = 0
r = 0
for (i, val) in enumerate(values):
	x = val + r
	if x == 0:
		continue
	elif x < k and r > 0:
		r = 0
		bags += 1
	else:
		bags += x // k
		r = x % k
if r > 0:
	bags += 1
print(bags)


(n, k) = map(int, input().split())
a = [*map(int, input().split())]
(res, rest) = (0, 0)
for (i, x) in enumerate(a):
	if rest == 0:
		rest = x % k
		res += x // k
	else:
		item = min(k - rest, x)
		x -= item
		res += x // k + 1
		rest = x % k
if rest != 0:
	res += 1
print(res)


from os import path
import sys, time
from math import ceil, floor, gcd, log, log2, factorial
from collections import defaultdict, Counter, deque
from itertools import permutations
maxx = float('inf')
I = lambda : int(sys.stdin.buffer.readline())
tup = lambda : map(int, sys.stdin.buffer.readline().split())
lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
S = lambda : sys.stdin.readline().replace('\n', '').strip()

def grid(r, c):
	return [lint() for i in range(r)]
stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
localsys = 0
start_time = time.time()
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
(n, k) = tup()
ls = lint()
ans = 0
for i in range(n):
	if ls[i] == 0:
		continue
	ans += ceil(ls[i] / k)
	if ls[i] % k > 0:
		extra = k - ls[i] % k
		if i + 1 < n:
			ls[i + 1] = max(0, ls[i + 1] - extra)
print(ans)
if localsys:
	print('\n\nTime Elased :', time.time() - start_time, 'seconds')


import math
(n, k) = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]

def check():
	n = len(a)
	res = 0
	sum0 = 0
	for i in range(n):
		res0 = res
		if res == 0:
			if a[i] < k:
				res = a[i]
				if i == n - 1 and a[i] != 0:
					sum0 += 1
			else:
				if i == n - 1:
					sum0 += math.ceil(a[i] / k)
				else:
					sum0 += int(a[i] / k)
				res = a[i] % k
		else:
			if i == n - 1:
				sum0 += math.ceil((a[i] + res) / k)
			else:
				sum0 += max(int((a[i] + res) / k), 1)
			res = (a[i] + res) % k if a[i] + res >= k else 0
	print(sum0)
check()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(ans, left) = (0, 0)
for i in range(n):
	use = (left + k - 1) // k
	ans += use
	left += a[i]
	left = max(0, left - use * k)
ans += (left + k - 1) // k
print(ans)


(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
(bags, capacity) = (0, 0)
for i in range(n):
	x = a[i] + capacity
	if x == 0:
		continue
	elif x < k and capacity > 0:
		bags += 1
		capacity = 0
	else:
		bags += x // k
		capacity = x % k
if capacity > 0:
	bags += 1
print(bags)


import math as ma
import sys
from sys import exit
from decimal import Decimal as dec
from itertools import permutations

def li():
	return list(map(int, input().split()))

def num():
	return map(int, input().split())

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
(n, k) = num()
a = li()
z = 0
x = 0
for i in range(n):
	if z % k == 0:
		x += int(ma.ceil(z / k)) + a[i] // k
		z = a[i] % k
	else:
		cp = z % k
		zz = a[i] - (k - cp)
		if zz < 0:
			zz = 0
		x += int(ma.ceil(z / k)) + zz // k
		z = zz % k
if z > 0:
	x += 1
print(x)


from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
prev = 0
ans = 0
for x in a:
	t = ceil(prev / k)
	ans += t
	prev = max(0, x - t * k + prev)
print(ans + ceil(prev / k))


from math import ceil as c
(n, k) = map(int, input().split())
(a, cnt) = (list(map(int, input().split())), 0)
for i in range(n - 1):
	cnt += c(a[i] / k)
	a[i + 1] = max(a[i + 1] + a[i] % k - (a[i] % k != 0) * k, 0)
print(cnt + c(a[-1] / k))


import math
(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
(s, f) = (0, 0)
for i in range(n - 1):
	(t1, t2) = (a[i] // k, a[i] % k)
	if a[i]:
		if t1:
			s += t1
			if t2:
				a[i + 1] += t2
				f = 1
			else:
				f = 0
		elif f:
			s += 1
			f = 0
		else:
			a[i + 1] += a[i]
			f = 1
	else:
		continue
s += math.ceil(a[-1] / k)
print(s)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
space = 0
bag = 0
for i in a:
	if space:
		if i >= space:
			i -= space
			space = 0
		else:
			space = 0
			i = 0
	b = i // k
	rem = i % k
	if space == 0:
		bag += b
		if rem:
			bag += 1
			space = k - rem
print(bag)


import math
(n, k) = map(int, input().strip().split(' '))
lst = list(map(int, input().strip().split(' ')))
c = 0
f = 0
for j in range(n):
	if j == n - 1:
		c += math.ceil(lst[j] / k)
	elif lst[j] == 0:
		f = 0
	elif lst[j] == k:
		c += 1
		f = 0
	elif lst[j] < k:
		if f == 0:
			lst[j + 1] += lst[j]
			f = 1
		else:
			c += 1
			f = 0
	elif lst[j] > k:
		c += lst[j] // k
		lst[j + 1] += lst[j] % k
		if lst[j] % k != 0:
			f = 1
		else:
			f = 0
print(c)


import math
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
b = 0
for i in range(n):
	if i != 0:
		l[i] = l[i] + l[i - 1]
	if i != 0 and l[i] < k and (l[i - 1] != 0):
		b = b + 1
		l[i] = 0
	else:
		b = b + int(l[i] / k)
	l[i] = l[i] % k
if l[n - 1] != 0:
	b = b + math.ceil(l[n - 1] / k)
print(b)


(n, k) = map(int, input().strip().split())
a = list(map(int, input().strip().split()))
mlft = 0
ans = 0
for i in range(n):
	mtoday = (mlft + a[i]) // k
	if mlft > 0 and mtoday == 0:
		mlft = 0
		mtoday += 1
	else:
		mlft = (mlft + a[i]) % k
	ans += mtoday
if mlft > 0:
	ans += 1
print(ans)


(n, k) = [int(k) for k in input().split()]
a = [int(k) for k in input().split()]
carry = 0
ans = 0
for i in range(n):
	temp = 0
	if i == n - 1:
		ans += (carry + a[n - 1]) // k
		if (carry + a[n - 1]) % k:
			ans += 1
	else:
		if carry:
			if not (carry + a[i]) // k:
				temp += 1
		temp += (carry + a[i]) // k
		carry = max(0, a[i] + carry - temp * k)
		ans += temp
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(b, r) = (0, 0)
for i in a:
	i += r
	n = i // k
	b += n
	if n == 0 and r != 0:
		b += 1
		r = 0
		continue
	r = i - n * k
if r != 0:
	b += 1
print(b)


import os
import sys
from io import BytesIO, IOBase
import math
from queue import Queue
import itertools
import bisect
import heapq

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	for i in range(2, n + 1):
		if primes[i]:
			for j in range(i + i, n + 1, i):
				primes[j] = False
	p = []
	for i in range(0, n + 1):
		if primes[i]:
			p.append(i)
	return p

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac

def sod(n):
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	return s

def chk(x, ind):
	s = sum(l)
	for i in range(0, n + 2):
		out = l[i]
		if s == 2 * x + out and ind != i:
			return out
	return -1
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
old = 0
for i in range(0, n - 1):
	if old != 0:
		if l[i] >= k - old:
			l[i] -= k - old
			ans += 1
			ans += l[i] // k
		else:
			l[i] = 0
			ans += 1
	else:
		ans += l[i] // k
	new = l[i] % k
	old = new
ans += math.ceil((l[-1] + old) / k)
print(ans)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
bal = 0
for i in range(n):
	if (l[i] + bal) % k > l[i]:
		ans += (l[i] + bal) // k
		bal = 0
		ans += 1
	else:
		ans += (l[i] + bal) // k
		bal = (l[i] + bal) % k
if bal > 0:
	ans += 1
print(ans)


from math import ceil
(n, k) = map(int, input().split())
a = [0] + list(map(int, input().split())) + [0]
bags = 0
for i in range(1, n + 2):
	bags += a[i - 1] // k
	y = a[i - 1] % k
	if y > 0:
		bags += 1
		a[i] = max(a[i] - (k - y), 0)
print(bags)


(n, k) = map(int, input().split())
lis = list(map(int, input().split()))
ans = 0
for i in range(n):
	ans += lis[i] // k
	rem = lis[i] % k
	lis[i] = rem
	if rem:
		ans += 1
		if i >= n - 1:
			break
		lis[i + 1] = max(0, lis[i + 1] - (k - rem))
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
rem = 0
days = 0
for i in range(n):
	if i == n - 1:
		days = days + (a[n - 1] + rem + k - 1) // k
	else:
		x = rem + a[i]
		if x % k == 0:
			days += x // k
			rem = 0
		else:
			if rem > 0:
				days += 1
				a[i] -= k - rem
			if a[i] >= 0:
				days += a[i] // k
				rem = a[i] % k
			else:
				rem = 0
print(days)


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


from math import ceil
b = input().split()
n = int(b[0])
k = int(b[1])
a = input().split()
summa = 0
current = 0
for i in range(n):
	a[i] = int(a[i])
if n == 1:
	print(int(ceil(a[0] / k)))
else:
	for i in range(n - 1):
		if a[i] >= k:
			bags = a[i] // k
			summa += bags
			a[i] -= bags * k
		elif current > 0:
			summa += 1
			a[i] = 0
		current = a[i]
		if current > 0:
			a[i + 1] += current
	print(int(summa + ceil(a[n - 1] / k)))


import math as mt
import sys, string
from collections import Counter, defaultdict
input = sys.stdin.readline
MOD = 1000000007
I = lambda : int(input())
M = lambda : map(int, input().split())
Ms = lambda : map(str, input().split())
ARR = lambda : list(map(int, input().split()))

def solve():
	(n, k) = M()
	garbadges = ARR()
	bags = 0
	i = 0
	while i < n:
		if garbadges[i] >= k:
			bags += garbadges[i] // k
			garbadges[i] -= garbadges[i] // k * k
			continue
		elif garbadges[i] < k and garbadges[i] > 0:
			bags += 1
			if i + 1 < n:
				garbadges[i + 1] -= k - garbadges[i]
		i += 1
	print(bags)
tc = 1
for _ in range(tc):
	solve()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
bags = 0
carry = 0
for i in range(n):
	new = a[i]
	if carry == 0:
		bags += new // k
		carry = new % k
	else:
		bags += 1
		new -= k - carry
		if new <= 0:
			carry = 0
		else:
			bags += new // k
			carry = new % k
if carry > 0:
	bags += 1
print(bags)


(n, k) = map(int, input().split())
a = [0] + list(map(int, input().split()))
a.append(0)
bag = 0
for i in range(1, n + 2):
	t = (a[i - 1] + a[i]) // k
	if t > 0:
		bag += t
		t = t * k - a[i - 1]
		a[i] -= t
	elif a[i - 1] > 0:
		bag += 1
		a[i] = 0
print(bag)


def main():
	(n, k) = map(int, input().split())
	sm = list(map(int, input().split()))
	last = 0
	cnt = 0
	for v in sm:
		if last > 0:
			cnt += 1
			v -= min(k - last, v)
		cnt += v // k
		last = v % k
	if last != 0:
		cnt += 1
	print(cnt)
main()


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
pre = A[0]
cnt = 0
for i in range(1, N):
	cnt += pre // K + int(pre % K != 0)
	pre = max(0, A[i] - (K - pre % K) * int(pre % K != 0))
cnt += pre // K + int(pre % K != 0)
print(cnt)


def read():
	return list(map(int, input().split()))

def solve(n, k, A):
	(ans, prev) = (0, 0)
	for a in A:
		total = prev + a
		if prev and total < k:
			ans += 1
			total = 0
		elif total >= k:
			ans += total // k
			total %= k
		prev = total
	ans += prev // k
	ans += 1 if prev % k > 0 else 0
	return ans
(n, k) = read()
A = read()
print(solve(n, k, A))


(n, k) = map(int, input().split())
t = list(map(int, input().split()))
t_bool = []
for x in range(0, len(t), +1):
	t_bool.append(False)
wyn = 0
r = 0
przel = False
for x in range(0, len(t), +1):
	if t_bool[x] == True:
		if t[x] != 0:
			wyn += 1
		t[x] -= k
		if t[x] < 0:
			t[x] = 0
	wyn += int(t[x] / k)
	if t[x] % k != 0:
		if x != len(t) - 1:
			t[x + 1] += t[x] % k
			t_bool[x + 1] = True
		else:
			wyn += 1
print(wyn)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
c = 0
r = 0
for i in range(n):
	x = l[i] + r
	if x == 0:
		continue
	elif x < k and r > 0:
		c += 1
		r = 0
	else:
		c += x // k
		r = x % k
if r > 0:
	c += 1
print(c)


nandk = [int(x) for x in input().split()]
n = nandk[0]
k = nandk[1]
garbages = [int(x) for x in input().split()]
output = 0
if garbages[0] % k == 0:
	output += garbages[0] // k
elif garbages[0] > k:
	output += garbages[0] // k + 1
else:
	output += 1
if garbages[0] % k > 0:
	left = k - garbages[0] % k
else:
	left = 0
for i in range(1, n):
	true = garbages[i] - left
	if true < 0:
		left = 0
		pass
	elif true % k == 0:
		output += true // k
		left = 0
	elif true > k:
		output += true // k + 1
		left = k - true % k
	else:
		output += 1
		left = k - true
print(output)


(n, k) = map(int, input().split())
r = 0
m = 0
for i in input().split():
	a = int(i) + m
	if a < k:
		if m != 0:
			r += 1
			m = 0
		else:
			m = a
	else:
		r += a // k
		m = a % k
r += (m + k - 1) // k
print(r)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
prev = 0
for i in range(n):
	if prev == 0:
		if i < n - 1:
			ans += a[i] // k
			prev = a[i] % k
		else:
			ans += (a[i] + k - 1) // k
	else:
		a[i] -= k - prev
		ans += 1
		if a[i] <= 0:
			prev = 0
		elif i < n - 1:
			ans += a[i] // k
			prev = a[i] % k
		else:
			ans += (a[i] + k - 1) // k
print(ans)


(n, k) = map(int, input().split())
A = [int(a) for a in input().split()]
cnt = 0
carry = 0
aux = 0
for i in range(n):
	if carry > 0:
		if A[i] + carry >= k:
			cnt += 1
			A[i] -= k - carry
			carry = 0
			if A[i] >= k:
				cnt += A[i] // k
				aux = A[i] % k
			else:
				aux = A[i]
			carry = aux
		else:
			cnt += 1
			carry = 0
			aux = 0
	else:
		if A[i] >= k:
			cnt += A[i] // k
			aux = A[i] % k
		else:
			aux = A[i]
		carry = aux
if carry > 0:
	cnt += 1
print(cnt)


import math
(n, k) = map(int, input().split(' '))
plan = list(input().split())
plan = [int(x) for x in plan]
count = 0
temp = 0
for i in range(len(plan)):
	if i == n - 1:
		if temp == 0:
			count += math.ceil(plan[i] / k)
			break
		else:
			plan[i] -= k - temp
			count += 1
			temp = 0
			if plan[i] < 0:
				plan[i] = 0
			count += math.ceil(plan[i] / k)
			break
	if temp != 0:
		plan[i] -= k - temp
		count += 1
		temp = 0
		if plan[i] < 0:
			plan[i] = 0
	count += int(plan[i] / k)
	temp = plan[i] % k
print(int(count))


(n, m) = list(map(int, input().split()))
s = list(map(int, input().split()))
mdu = 0
need = 0
for i in range(n):
	x = (mdu + s[i]) // m
	if mdu > 0 and x == 0:
		need += 1
		mdu = 0
	else:
		mdu = (mdu + s[i]) % m
		need += x + 1 if i == n - 1 and mdu > 0 else x
print(need)


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))


import sys
from math import ceil
input = sys.stdin.buffer.readline

def print(val):
	sys.stdout.write(str(val) + '\n')

def prog():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	used = 0
	for i in range(len(a)):
		if a[i] == 0:
			continue
		used += ceil(a[i] / k)
		if a[i] % k > 0:
			leftover = k - a[i] % k
		else:
			leftover = 0
		if i < len(a) - 1:
			a[i + 1] = max(0, a[i + 1] - leftover)
	print(used)
prog()


import bisect
from itertools import accumulate
import os
import sys
import math
from decimal import *
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def factors(n):
	fac = []
	while n % 2 == 0:
		fac.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 2):
		while n % i == 0:
			fac.append(i)
			n = n // i
	if n > 1:
		fac.append(n)
	return fac
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
c = 0
r = 0
for i in range(n):
	x = l[i] + r
	if x == 0:
		continue
	elif x < k and r > 0:
		c += 1
		r = 0
	else:
		c += x // k
		r = x % k
if r > 0:
	c += 1
print(c)


from sys import stdin, stdout
from math import ceil

def main():
	(n, k) = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))
	ans = 0
	for i in range(1, n):
		s = a[i - 1] + a[i]
		q = s // k
		ans += q
		if q == 0 and a[i - 1] != 0:
			ans += 1
			a[i] = 0
		else:
			a[i] = a[i] - (q * k - a[i - 1])
	ans += ceil(a[n - 1] / k)
	stdout.write('%d\n' % ans)
main()


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
sumA = 0
yesterday = 0
for i in range(n):
	next = a[i] + yesterday
	bag = next // k
	sumA += bag
	if a[i] == 0:
		if bag == 0 and next > 0:
			sumA += 1
			yesterday = 0
	elif bag == 0 and yesterday > 0:
		sumA += 1
		yesterday = 0
	else:
		yesterday = next % k
if yesterday > 0:
	sumA += 1
print(sumA)


from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
bag = 0
carry = 0
for i in a:
	if carry == 0:
		carry = i
		continue
	bag_current = -(-carry // k)
	bag += bag_current
	remain = bag_current * k - carry
	if remain >= i:
		carry = 0
	else:
		carry = i - remain
bag += -(-carry // k)
print(bag)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
arr = input().split(' ')
Ans = 0
remain = 0
for i in range(0, n):
	temp = (remain + int(arr[i])) // k
	if temp == 0 and remain != 0:
		Ans = Ans + 1
		remain = 0
	else:
		remain = remain + int(arr[i]) - temp * k
		Ans = temp + Ans
if remain != 0:
	Ans = Ans + 1
print(Ans)


import math
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
s = 0
c = 0
sum = 0
for i in range(n - 1):
	if c > 0:
		s = math.floor((a[i] + c) / m)
		if s == 0:
			sum += 1
			c = 0
		else:
			sum += s
			c = a[i] + c - s * m
	else:
		s = math.floor((a[i] + c) / m)
		sum += s
		c = a[i] + c - s * m
sum += math.ceil((a[n - 1] + c) / m)
print(sum)


line = input()
(n, k) = map(int, line.split(' '))
ins = map(int, input().split(' '))
result = 0
mod = 0
for (x, i) in enumerate(ins):
	(div, mod) = divmod(i + mod, k)
	result += div
	if mod > i:
		result += 1
		mod = 0
if mod > 0:
	result += 1
print(result)


import sys

def fi():
	return sys.stdin.readline()
(n, k) = map(int, fi().split())
l = list(map(int, fi().split()))
prev = 0
c = 0
for i in range(n):
	curr = 0
	if prev and i != 0:
		if prev >= k:
			c += prev // k
	curr = prev % k
	if l[i] >= k - curr:
		c += 1
		prev = l[i] - k + curr
	elif l[i] < k - curr and i != 0 and (curr != 0):
		c += 1
		prev = 0
	else:
		prev = l[i]
if prev > 0:
	if prev % k == 0:
		c += prev // k
	else:
		c += prev // k + 1
print(c)