Anastasia loves going for a walk in Central Uzhlyandian Park. But she became uninterested in simple walking, so she began to collect Uzhlyandian pebbles. At first, she decided to collect all the pebbles she could find in the park.

She has only two pockets. She can put at most k pebbles in each pocket at the same time. There are n different pebble types in the park, and there are w_{i} pebbles of the i-th type. Anastasia is very responsible, so she never mixes pebbles of different types in same pocket. However, she can put different kinds of pebbles in different pockets at the same time. Unfortunately, she can't spend all her time collecting pebbles, so she can collect pebbles from the park only once a day.

Help her to find the minimum number of days needed to collect all the pebbles of Uzhlyandian Central Park, taking into consideration that Anastasia can't place pebbles of different types in same pocket.


-----Input-----

The first line contains two integers n and k (1 ≤ n ≤ 10^5, 1 ≤ k ≤ 10^9) — the number of different pebble types and number of pebbles Anastasia can place in one pocket.

The second line contains n integers w_1, w_2, ..., w_{n} (1 ≤ w_{i} ≤ 10^4) — number of pebbles of each type. 


-----Output-----

The only line of output contains one integer — the minimum number of days Anastasia needs to collect all the pebbles.


-----Examples-----
Input
3 2
2 3 4

Output
3

Input
5 4
3 1 8 9 7

Output
5



-----Note-----

In the first sample case, Anastasia can collect all pebbles of the first type on the first day, of second type — on the second day, and of third type — on the third day.

Optimal sequence of actions in the second sample case:   In the first day Anastasia collects 8 pebbles of the third type.  In the second day she collects 8 pebbles of the fourth type.  In the third day she collects 3 pebbles of the first type and 1 pebble of the fourth type.  In the fourth day she collects 7 pebbles of the fifth type.  In the fifth day she collects 1 pebble of the second type.

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Implementation


Solutions:
import math
x = list(map(int, input().split()))
num_types = x[0]
pocket_size = x[1]
pebble_list = list(map(int, input().split()))
num_pockets_filled = 0
for i in range(num_types):
	curr = pebble_list[i]
	num_pockets_filled += math.ceil(curr / pocket_size)
print(num_pockets_filled // 2 + num_pockets_filled % 2)


import math
(n, k) = list(map(int, input().split()))
w = [int(i) for i in input().split()]
res = []
for i in range(n):
	res.append(w[i] // k)
	res.append(bool(w[i] % k))
print(math.ceil(sum(res) / 2))


from sys import stdin, stdout
(n, k) = map(int, stdin.readline().rstrip().split())
pebbleList = [int(a) for a in stdin.readline().rstrip().split()]
nTrips = []
for i in range(n):
	nTrips.append(pebbleList[i] // k)
	if pebbleList[i] % k != 0:
		nTrips[i] += 1
total = sum(nTrips) // 2 + sum(nTrips) % 2
print(total)


(n, k) = map(int, input().split())
a = map(int, input().split())
cnt = 0
for x in a:
	cnt += (x + k - 1) // k
print((cnt + 1) // 2)


import math
(n, k) = map(int, input().split())
w = list(map(int, input().split()))
a = 0
for x in w:
	a += math.ceil(x / k)
print(math.ceil(a / 2))


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


from math import ceil
(n, s) = map(int, input().split())
peb = map(int, input().split())
d = 0
for p in peb:
	d += ceil(p / s)
print(ceil(d / 2))


import math
(n, k) = map(int, input().split())
ls = list(map(int, input().split()))
res = int(0)
for i in ls:
	res += math.ceil(i / k)
print(math.ceil(res / 2.0))


import sys
import math
fin = sys.stdin
fout = sys.stdout
(n, k) = map(int, fin.readline().split())
a = list(map(int, fin.readline().split()))
ans = 0
i = 0
while i < n:
	ans += math.ceil(a[i] / k)
	i += 1
fout.write(str(math.ceil(ans / 2)))


def R():
	return [int(x) for x in input().split()]
(n, k) = R()
w = R()
result = 0
for _w in w:
	if _w < k:
		result += 1
	elif _w % k == 0:
		result += _w // k
	else:
		result += _w // k + 1
if result % 2 == 0:
	print(result // 2)
else:
	print(result // 2 + 1)


(n, k) = map(int, input().split())
array = list(map(int, input().split()))
ans = 0
for i in range(n):
	ans += (array[i] + k - 1) // k
print((ans + 1) // 2)


(n, k) = map(int, input().split())
line = map(int, input().split())
line = [(it + k - 1) // k for it in line]
print((sum(line) + 1) // 2)


def solve():
	(n, k) = map(int, input().split())
	w = [int(i) for i in input().split()]
	p = 0
	for i in w:
		p += (i + k - 1) // k
	print((p + 1) // 2)
solve()


import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
(N, K) = invr()
W = inlt()
W.sort()
n = 0
out = 0
while n < N - 1:
	if W[n] <= K:
		W[n] = 0
		if W[n + 1] <= K:
			W[n + 1] = 0
			n += 1
		else:
			W[n + 1] -= K
		n += 1
		out += 1
	else:
		curr = W[n] // K
		out += curr
		W[n] -= K * curr
		W[n + 1] -= K * curr
		if W[n] == 0:
			n += 1
			if W[n] == 0:
				n += 1
if n == N - 1 and W[n] != 0:
	out += W[n] // (K * 2)
	if W[n] % (K * 2) != 0:
		out += 1
print(out)


(n, k) = map(int, input().split())
w = map(int, input().split())
ans = 1
for x in w:
	ans += (x + k - 1) // k
print(ans // 2)


s = input()
(n, k) = s.split()
n = int(n)
k = int(k)
w = list()
ret = 0
s = input()
w = s.split()
for i in w:
	t = int(i)
	ret += (t + k - 1) // k
ret = (ret + 1) // 2
print(ret)


def main():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	for i in a:
		ans += i // k + (i % k > 0)
	print(ans // 2 + (ans % 2 > 0))
main()


(n, k) = map(int, input().split())
W = list(map(int, input().split()))
c = 0
for i in W:
	c = c + (i - 1) // k + 1
print((c + 1) // 2)


from math import ceil
(n, m) = map(int, input().split())
s = list(map(int, input().split()))
res = 0
for i in s:
	res += ceil(i / m)
print(ceil(res / 2))


import math
(n, k) = input().split()
l = []
l = input().split()
c = 0
for i in range(0, len(l)):
	b = int(l[i])
	c = c + math.ceil(b / int(k))
print(math.ceil(c / 2))


import math
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
nbr_days = 0
for i in range(n - 1):
	if l[i] > 0:
		t = math.ceil(l[i] / k)
		nbr_days += t
		l[i + 1] -= t * k
if l[n - 1] > 0:
	t = l[n - 1] / (2 * k)
	t = math.ceil(t)
	nbr_days += t
print(nbr_days, end='')


import math

def pebbles(arr1, k):
	ans = 0
	for i in range(len(arr1)):
		ans += math.ceil(arr1[i] / k)
	return math.ceil(ans / 2)
(n, k) = map(int, input().split())
arr1 = list(map(int, input().split()))
print(pebbles(arr1, k))


(n, count_in_bag) = list(map(int, input().split()))
sort_stones = list(map(int, input().split()))
days = 0
while len(sort_stones) > 0:
	k = 0
	if sort_stones[0] > 2 * count_in_bag:
		k = sort_stones[0] // (2 * count_in_bag)
		sort_stones[0] -= k * (2 * count_in_bag)
	if sort_stones[0] > 0:
		k += 1
		if sort_stones[0] <= count_in_bag:
			if len(sort_stones) > 1:
				if sort_stones[1] <= count_in_bag:
					del sort_stones[1]
				else:
					sort_stones[1] -= count_in_bag
	del sort_stones[0]
	days += k
print(days)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
import math
for i in l:
	ans += math.ceil(i / k)
print(math.ceil(ans / 2))


from math import *
first = input()
first = [int(x) for x in first.split()]
n = first[0]
k = first[1]
a = input()
a = [int(x) for x in a.split()]
for i in range(n):
	a[i] = ceil(float(a[i]) / k)
a.sort()
ans = 0
for i in range(n):
	if a[i] == 0:
		continue
	elif i == n - 1:
		ans += ceil(float(a[i]) / 2)
	else:
		x = min(a[i], a[i + 1])
		ans += x
		a[i] -= x
		a[i + 1] -= x
print(ans)


from collections import deque
from sys import stdin
from math import ceil
lines = deque((line.strip() for line in stdin.readlines()))

def nextline():
	return lines.popleft()

def types(cast):
	return tuple((int(x) for x in nextline().split()))

def ints():
	return types(int)

def strs():
	return nextline().split()

def main():
	(n, k) = ints()
	ws = ints()
	count = ceil(sum((ceil(x / k) for x in ws)) / 2)
	print(count)
main()


import math

def main():
	(n, k) = map(int, input().split())
	W = list(map(int, input().split()))
	Z = list(map(lambda x: math.ceil(x / k), W))
	Z.sort()
	print(math.ceil(sum(Z) / 2))
main()


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
i = 0
c = 0
for i in range(len(a)):
	if a[i] <= k:
		continue
	elif a[i] <= 2 * k:
		a[i] = 0
		c += 1
	else:
		c += a[i] // (2 * k)
		a[i] = a[i] % (2 * k)
for i in range(len(a)):
	if a[i] <= k:
		continue
	elif a[i] <= 2 * k:
		a[i] = 0
		c += 1
	else:
		c += a[i] // (2 * k)
		a[i] = a[i] % (2 * k)
kc = len(a) - a.count(0)
kc += 1 if kc % 2 != 0 else 0
print(c + kc // 2)


(n, k) = [int(i) for i in input().split()]
w = [int(i) for i in input().split()]
w.sort()
m = 0
for i in w:
	m += (i + k - 1) // k
print((m + 1) // 2)


(n, k) = [int(i) for i in input().split()]
w = [int(i) for i in input().split()]
ans = 0
for i in range(n):
	ans += (w[i] + k - 1) // k
print((ans + 1) // 2)


from math import ceil
read = lambda : tuple(map(int, input().split()))
(n, k) = read()
v = sum([ceil(x / k) for x in read()])
print(ceil(v / 2))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = 0
for i in a:
	s += (i + k - 1) // k
print((s + 1) // 2)


(n, k) = map(int, input().split())
lst = [int(i) for i in input().split()]
count = 0
for i in range(n):
	count += (lst[i] + k - 1) // k
count = (count + 1) // 2
print(count)


(n, k) = map(int, input().split())
w = [int(i) for i in input().split()]
h = 0
for i in w:
	if i % k:
		h += int((i - i % k) / k) + 1
	else:
		h += int(i / k)
if h % 2:
	print(int((h + 1) / 2))
else:
	print(int(h / 2))


(n, k) = map(int, input().split())
ws = list((int(x) for x in input().split()))
result = 0
free_pocket = False
for w in ws:
	needed_pockets = (w + k - 1) // k
	if needed_pockets % 2 == 0:
		result += needed_pockets // 2
	else:
		if free_pocket:
			result += (needed_pockets - 1) // 2
		else:
			result += (needed_pockets + 1) // 2
		free_pocket = not free_pocket
print(result)


from math import ceil
X = list(map(int, input().split()))
Types = list(map(int, input().split()))
print(ceil(sum((ceil(i / X[1]) for i in Types)) / 2))


(n, k) = input().strip().split(' ')
(n, k) = (int(n), int(k))
list1 = list(map(int, input().strip().split(' ')))
a = 0
b = 0
k2 = 2 * k
for x in list1:
	if x % k == 0:
		a += x // k
	else:
		a += x // k + 1
print(a // 2 + a % 2)


(n, k) = map(int, input().split())
v = [int(x) for x in input().split()]
v.sort()
d = 0
for i in range(n):
	d = d + (v[i] + k - 1) // k
print((d + 1) // 2)


(n, k) = input().split()
w = [(int(i) - 1) // int(k) + 1 for i in input().split()]
s = sum(w)
m = max(w)
print(((s if s > m else m) + 1) // 2)


from math import ceil
(n, k) = map(int, input().split())
w = list(map(int, input().split()))
d = 0
for i in range(n):
	x = ceil(w[i] / k)
	d += x
print(ceil(d / 2))


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l)
p = 0
k = 0
for i in range(n):
	t = l[i] // m
	if l[i] % m != 0:
		t = t + 1
	t = t - p
	p = 0
	k = k + t // 2
	if t % 2 != 0:
		k = k + 1
		p = 1
print(k)


from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
result = 0
for i in range(n):
	result += ceil(a[i] / k)
print(ceil(result / 2))


(n, k) = map(int, input().split())
w = list(map(int, input().split()))
sum = 0
for i in w:
	a = i / k
	if a > int(a):
		sum += int(a) + 1
	else:
		sum += int(a)
sum /= 2
if sum > int(sum):
	print(int(sum) + 1)
else:
	print(int(sum))


(n, k) = [int(s) for s in input().split()]
w = [int(s) for s in input().split()]
d = 0
for i in range(n):
	if w[i] >= 2 * k:
		d += w[i] // (2 * k)
		w[i] = w[i] % (2 * k)
for i in range(n):
	if w[i] > k:
		d += 1
		w[i] = 0
m = 0
for i in range(n):
	if w[i] > 0:
		m += 1
d += m // 2 + m % 2
print(d)


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


(n, k) = list(map(int, input().split()))
w = list(map(int, input().split()))
ans = 0
for _ in w:
	ans += (_ + k - 1) // k
print((ans + 1) // 2)


import math
(n, k) = map(int, input().split())
w = [int(t) for t in input().split()]
res = x = 0
for i in range(n):
	x = w[i] / k
	y = math.ceil(x)
	res += y
print(math.ceil(res / 2))


(n, k) = [int(i) for i in input().split()]
w = [int(i) for i in input().split()]
tot = 0
for wi in w:
	tot += (wi + k - 1) // k
ans = (tot + 1) // 2
print(ans)


(n, k) = map(int, input().split())
W = list(map(int, input().split()))
ans = 0
for w in W:
	ans += w // k + int(w % k != 0)
print(ans // 2 + int(ans % 2 != 0))


import math
(n, k) = map(int, input().strip().split(' '))
lst = list(map(int, input().strip().split(' ')))
s = 0
for j in range(n):
	s += math.ceil(lst[j] / k)
print(math.ceil(s / 2))


R = lambda : list(map(int, input().split()))
(n, k) = R()
w = R()
print((sum(((i + k - 1) // k for i in w)) + 1) // 2)


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


import sys
(n, k) = map(int, input().split())
w = list(map(int, input().split()))
rem = 0
ans = 0
for i in range(n):
	if w[i] % k != 0:
		rem += 1
	ans += w[i] // k
res = 0
res += ans // 2
if ans % 2 != 0:
	rem += 1
res += rem // 2
if rem % 2 != 0:
	res += 1
print(res)


(n, k) = map(int, input().split())
p = map(int, input().split())
mod = 0
ans = 0
for x in p:
	t = x // k + (1 if x % k != 0 else 0)
	ans += (t + mod) // 2
	mod = (t + mod) % 2
if mod == 1:
	ans += 1
print(ans)


(n, k) = map(int, input().split())
ans = 0
for w in list(map(int, input().split())):
	ans += w // k + (0 if w % k == 0 else 1)
print(ans // 2 + ans % 2)


import sys
from math import ceil
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')
for _ in range(1):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	req = 0
	for i in range(n):
		req += ceil(l[i] / k)
	print(ceil(req / 2))


a = int(input().split()[1])
b = 0
for i in map(int, input().split()):
	(c, d) = divmod(i, a)
	b += c + bool(d)
print((b + 1) // 2)


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

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

def pt(x):
	print(x)

def ip():
	return input()

def it():
	return int(input())

def sl(x):
	return [t for t in x]

def spl(x):
	return x.split()

def aj(liste, item):
	liste.append(item)

def bin(x):
	return '{0:b}'.format(x)

def listring(l):
	return ' '.join([str(x) for x in l])

def ptlist(l):
	print(' '.join([str(x) for x in l]))
(n, k) = mp()
w = lt()
pt((sum(((i + k - 1) // k for i in w)) + 1) // 2)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
s = 0
for i in range(n):
	s += (A[i] + k - 1) // k
print((s + 1) // 2)


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


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
t = 0
for i in range(n):
	t += a[i] // k
	if a[i] % k != 0:
		t += 1
h = t // 2
if t % 2 == 1:
	h += 1
print(h)


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
c = 0
i = 0
while i < n:
	if s[i] <= k and s[i] != 0:
		if i + 1 != n:
			if s[i + 1] > k:
				s[i + 1] -= k
			else:
				s[i + 1] = 0
		c += 1
		i += 1
	elif s[i] == 2 * k:
		c += 1
		i += 1
	elif s[i] > 2 * k:
		c += s[i] // (2 * k)
		s[i] -= s[i] // (2 * k) * 2 * k
	elif s[i] > k and s[i] < 2 * k:
		c += 1
		i += 1
	elif s[i] == 0:
		i += 1
print(c)


a = list(map(int, input().split()))
n = a[0]
k = a[1]
a = list(map(int, input().split()))
b = [0] * n
s = [0] * 2
m = 0
i = 0
while m != n:
	b = a[m] // k
	if a[m] % k > 0:
		b = int(a[m] / k) + 1
	i += b
	m += 1
if i % 2 > 0:
	print(int(i / 2) + 1)
else:
	print(int(i / 2))


import math
(n, k) = map(int, input().split())
pebbles = map(int, input().split())
sum = 0
for pebble in pebbles:
	sum += math.ceil(pebble / k)
print(math.ceil(sum / 2))


from math import ceil
(stone_amount, pocket_size) = [int(x) for x in input().split(' ')]
stone_types = [int(x) for x in input().split(' ')]
days = 0

def func(i):
	global days
	days += round(i // pocket_size)
	if i % pocket_size != 0:
		days += 1
list(map(func, stone_types))
print(round(days // 2) + days % 2)


import math
(types_of_peeble, pocket_size) = map(int, input().split())
pebble_array = list(map(int, input().split()))
i = pocket = 0
while types_of_peeble > 0:
	pebble = pebble_array[i]
	if pebble <= pocket_size:
		pocket += 1
	elif pebble > pocket_size and pebble <= 2 * pocket_size:
		pocket += 2
	else:
		pocket += pebble // pocket_size
		pebble = pebble % pocket_size
		if pebble == 0:
			pass
		else:
			pocket += 1
	types_of_peeble -= 1
	i += 1
print(math.ceil(pocket / 2))


import math as m
(n, k) = map(int, input().split())
w = list(map(int, input().split()))
print(m.ceil(sum([m.ceil(it / k) for it in w]) / 2))


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


(n, k) = map(int, input().split())
ans = 0
for i in input().split():
	ans += (int(i) + k - 1) // k
print((ans + 1) // 2)


(n, k) = input().strip().split()
(n, k) = (int(n), int(k))
cnt = 0
a = [int(i) for i in input().strip().split()]
a.sort()
for j in a:
	if j / k == j // k:
		cnt += j // k
	else:
		cnt = cnt + j // k + 1
if cnt / 2 == cnt // 2:
	print(int(cnt // 2))
else:
	print(int(cnt // 2 + 1))


import math
queries = [int(i) for i in input().split()]
n = queries[0]
k = queries[1]
list = [int(i) for i in input().split()]
number_of_days = 0
for i in range(n):
	number_of_days += math.ceil(list[i] / k)
number_of_days = math.ceil(number_of_days / 2)
print(number_of_days)


import sys
import math

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

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

def listinput():
	return list(map(int, input().split()))
(n, k) = minput()
w = listinput()
ans = 0
for i in w:
	ans += math.ceil(i / k)
print(math.ceil(ans / 2))


(_, cap) = (int(x) for x in input().split())
items = [int(x) for x in input().split()]
res = 0
for item in items:
	times = item // cap
	res += times
	if times * cap < item:
		res += 1
days = res // 2
print(days if days * 2 == res else days + 1)


from math import ceil
a = input().split(' ')
b = input().split(' ')
k = int(a[1])
n = 0
q = 0
for i in b:
	q += 1
	if int(i) <= int(b[q - 1]):
		n += ceil(int(b[q - 1]) / k)
	else:
		n += 1
print(ceil(n / 2))


(N, K) = map(int, input().split())
W = [int(x) for x in input().split()]
ans = 0
for w in W:
	if w % K == 0:
		ans += w // K
	else:
		ans += w // K + 1
if ans % 2 == 0:
	print(ans // 2)
else:
	print(ans // 2 + 1)


import math
(n, k) = map(int, input().split(' '))
t = [int(c) for c in input().split(' ')]
s = 0
for i in t:
	s = s + math.ceil(i / k)
b = math.ceil(s / 2)
print(b)


import math
(n, k) = [int(f) for f in input().split()]
i = 0
p = 0
for x in input().split():
	x = int(x)
	p += math.ceil(x / k)
print(math.ceil(p / 2))


import math
(x, y) = map(int, input().split())
arr = list(map(int, input().split()))
s = 0
for i in range(0, x):
	s = s + math.ceil(arr[i] / y)
print(math.ceil(s / 2))


import math
(n, k) = map(int, input().split())
z = 0
li = [int(i) for i in input().split()]
for i in li:
	z += math.ceil(i / k)
print(math.ceil(z / 2))


ins = map(int, input().split())
(_, packet_n) = (next(ins), next(ins))
pepples = map(int, input().split())
tot = 0
for p in pepples:
	tot += p // packet_n
	if p % packet_n != 0:
		tot += 1
if tot % 2 == 0:
	print(tot // 2)
else:
	print(tot // 2 + 1)


def main():
	(n, m) = map(int, input().split())
	print((sum(((x + m - 1) // m for x in map(int, input().split()))) + 1) // 2)
main()


(n, k) = map(int, input().split(' '))
arr = [int(i) for i in input().split(' ')]
s = 0
for i in range(n):
	s += (arr[i] + k - 1) // k
print((s + 1) // 2)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))[:n]
(q1, z, c) = (0, 0, 0)
for i in a:
	if i <= k:
		c += 1
	elif i % k == 0:
		q = i // k
		c += q
	else:
		q1 = i // k
		q1 += 1
		c += q1
if c % 2 == 0:
	print(c // 2)
else:
	z = c // 2
	z += 1
	print(z)


(n, m) = map(int, input().split())
li = list(map(int, input().split()))
count = 0
for i in range(n):
	if li[i] % m == 0:
		count = count + li[i] // m
	else:
		count = count + li[i] // m + 1
if count % 2 == 0:
	print(count // 2)
else:
	print(count // 2 + 1)


(n, k) = [int(x) for x in input().split()]
stones = [int(x) for x in input().split()]
pockets = [(x + k - 1) // k for x in stones]
days = (sum(pockets) + 1) // 2
print(days)


import math
(n, k) = map(int, input().split())

def f(s):
	f = int(s)
	return math.ceil(f / k)
a = sum(map(f, input().split()))
print(math.ceil(a / 2))


(n, k) = map(int, input().split())
w = list(map(int, input().split()))
ans = 0
rem = 0
for wi in w:
	(d, r) = divmod(wi, 2 * k)
	ans += d
	if r > k:
		rem += 2
	elif r > 0:
		rem += 1
ans += (rem + 1) // 2
print(ans)


(n, m) = map(int, input().split())
a = map(int, input().split())
ans = 0
for i in a:
	ans += i // m if i % m == 0 else i // m + 1
print(int((ans + 1) / 2))


def ri():
	return list(map(int, input().split()))
(n, k) = ri()
w = list(ri())
ans = 0
for ww in w:
	if ww % k == 0:
		ans += ww // k
	else:
		ans += ww // k + 1
if ans % 2:
	print(ans // 2 + 1)
else:
	print(ans // 2)
print()


(n, k) = list(map(int, input().split()))
w = list(map(int, input().split()))
counter = 0
for i in w:
	current = i / k
	if int(current) != current:
		current = int(current) + 1
	counter += current
counter /= 2
if int(counter) != counter:
	counter = int(counter) + 1
print(int(counter))


(n, k) = map(int, input().split())
print((sum(((int(x) + k - 1) // k for x in input().split())) + 1) // 2)


r = lambda : map(int, input().split())
(n, k) = r()
p = list(r())
print((sum(((i + k - 1) // k for i in p)) + 1) // 2)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
counterS = 0
counterL = 0
for i in arr:
	if i <= k:
		counterS += 1
	elif i <= 2 * k:
		counterL += 1
	else:
		counterL += i // (2 * k)
		y = i - i // (2 * k) * (2 * k)
		if y <= k:
			if y != 0:
				counterS += 1
		else:
			counterL += 1
lastCounter = counterS // 2 + counterS % 2 + counterL
print(lastCounter)


import heapq
from collections import deque
import sys
(_, k) = map(int, input().split())
a = 0
for i in map(int, input().split()):
	c = (i + k - 1) // k
	a += c
print((a + 1) // 2)


(n, k) = map(int, input().split())
l = [int(i) for i in input().split()]
ans = []
for i in l:
	ans.append((i + k - 1) // k)
print((sum(ans) + 1) // 2)


import math
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
count1 = 0
count2 = 0
for i in range(0, n):
	count2 += int(l[i] / (2 * k))
	if l[i] % (2 * k) > 0:
		if l[i] % (2 * k) <= k:
			count1 += 1
		else:
			count2 += 1
print(math.ceil(count1 / 2) + count2)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
s = 0
for i in l:
	s += i // k
	if i % k != 0:
		s += 1
s = s // 2 + s % 2
print(s)


import math
(n, k) = [int(a) for a in input().rstrip().split()]
array = [int(a) for a in input().split()]
pocket = 0
for w in array:
	pocket += math.ceil(w / k)
days = math.ceil(pocket / 2)
print(days)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
z = 0
for x in a:
	z += (x + k - 1) // k
print((z + 1) // 2)


import sys
import math
import bisect

def solve(A, m):
	n = len(A)
	cnt = 0
	for i in range(n):
		val = (A[i] + m - 1) // m
		cnt += val
	ans = (cnt + 1) // 2
	return ans

def main():
	(n, m) = map(int, input().split())
	A = list(map(int, input().split()))
	ans = solve(A, m)
	print(ans)
main()


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

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

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def check(n, m, k):
	print('inside', n + (k - 1) * m, k * (k + 1) // 2, (n + (k - 1) * m) // k * k)
	if (n + (k - 1) * m) // k * k <= k * (k + 1) // 2:
		return True
	return False

def solve():
	(n, k) = map(int, input().split())
	peebles = list(map(int, input().split()))
	for i in range(n):
		peebles[i] = math.ceil(peebles[i] / k)
	print(math.ceil(sum(peebles) / 2))
for _ in range(1):
	solve()


import math
(n, k) = map(int, input().split())
stones = list(map(int, input().split()))
days = 0
for i in range(n):
	days += math.ceil(stones[i] / k)
print(math.ceil(days / 2))


[n, k] = list(map(int, input().split()))
w = list(map(int, input().split()))
res = 0
p = 0
while p < n:
	res += w[p] // (2 * k)
	w[p] = w[p] % (2 * k)
	if w[p] == 0:
		p += 1
	elif w[p] > k:
		w[p] = 0
		res += 1
		p += 1
	else:
		w[p] = 0
		if p + 1 < n:
			w[p + 1] = max(0, w[p + 1] - k)
		res += 1
		p += 1
print(res)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = 0
for item in a:
	s += item // k
	if item % k != 0:
		s += 1
if s % 2 == 1:
	print(s // 2 + 1)
else:
	print(s // 2)


from math import ceil
(n, m) = map(int, input().split())
l = list(map(int, input().split()))
i = 0
u = 0
days = 0
for i in range(n):
	days += ceil(l[i] / m)
print(ceil(days / 2))


import math
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
pocket = 0
for i in range(n):
	pocket += int(math.ceil(arr[i] / k))
print(int(math.ceil(pocket / 2)))


from math import ceil

def solve():
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	for i in range(n):
		l[i] = ceil(l[i] / k)
	r = 0
	l.sort()
	for i in range(n):
		if i + 1 != n and l[i]:
			r += l[i]
			l[i + 1] -= l[i]
			l[i] = 0
	return r + ceil(l[-1] / 2)
print(solve())


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
while A != []:
	if A[-1] > 2 * k:
		if A[-1] < 2 * k:
			ans += 1
		else:
			ans += A[-1] // (2 * k)
		A[-1] = A[-1] % (2 * k)
		if A[-1] == 0:
			A.pop()
	if A != [] and k < A[-1] <= 2 * k:
		A.pop()
		ans += 1
	if A != [] and A[-1] <= k:
		A.pop()
		if A != []:
			A[-1] = max(A[-1] - k, 0)
		ans += 1
	if A != [] and A[-1] == 0:
		A.pop()
print(ans)


import math
(n, k) = [int(a) for a in input().strip().split()]
w = [int(a) for a in input().strip().split()]
count = 0
for _w in w:
	l = _w // k
	count += l
	_w -= l * k
	if _w:
		count += 1
print(math.ceil(count / 2))


def main():
	(n, k) = map(int, input().split())
	w = [int(c) for c in input().split()]
	days = []
	for x in w:
		days.append(x // k if x % k == 0 else x // k + 1)
	s = sum(days)
	print(s // 2 if s % 2 == 0 else s // 2 + 1)
main()


import math
(types, capacity) = map(int, input().split())
pebbles = list(map(lambda x: math.ceil(x / capacity), map(int, input().split())))
print(math.ceil(sum(pebbles) / 2))


(n, k) = [int(i) for i in input().split()]
w = [int(i) for i in input().split()]
i = 0
x = 0
for i in w:
	if i % k == 0:
		x += i // k
	else:
		x += i // k + 1
print(x // 2 if x % 2 == 0 else x // 2 + 1)


from math import ceil
(n, k) = input().split()
n = int(n)
k = int(k)
x = list(map(int, input().split()))
y = []
for i in range(n):
	y.append(ceil(x[i] / k))
print(ceil(sum(y) / 2))


(n, k) = map(int, input().split())
w = list(map(int, input().split()))
q = 0
t = 0
for i in range(n):
	a = w[i] // k
	w[i] %= k
	q += a // 2
	t += a % 2
	if t == 2:
		t = 0
		q += 1
	if w[i] > 0:
		if t == 1:
			t = 0
			w[i] = 0
			q += 1
		else:
			w[i] = 0
			t += 1
if t > 0:
	q += 1
print(q)


(n, k) = map(int, input().split())
list_1 = [int(i) for i in input().split()]
print(-(sum([-(i // -k) for i in list_1]) // -2))


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
(n, k) = ilele()
A = alele()
if k == 1:
	print(math.ceil(sum(A) / 2))
	exit(0)
A.sort()
day = 1
a = -1
b = -1
for i in A:
	if i <= k:
		if a == -1:
			a = 1
		elif b == -1:
			b = 1
		else:
			day += 1
			a = 1
			b = -1
	else:
		pockets = math.ceil(i / k)
		c = pockets // 2
		day += c
		x = pockets % 2
		if x == 1:
			if a == -1:
				a = 1
			elif b == -1:
				b = 1
			else:
				day += 1
				a = 1
				b = -1
print(day)


(n, k) = map(int, input().split())
d = 0
t = sum(((i - 1) // k + 1 for i in map(int, input().split())))
print((t - 1) // 2 + 1)


import math
(n, k) = map(int, input().split())
w = [int(x) for x in input().split()]
pockt = 0
for i in range(n):
	pockt += w[i] // k
	w[i] = w[i] % k
pockt += sum([1 if x != 0 else 0 for x in w])
print(math.ceil(pockt / 2))


from math import ceil
(x, y) = map(int, input().split())
t = input()
a = ceil(sum([ceil(int(i) / y) for i in t.split()]) / 2)
print(a)


(n, k) = map(int, input().split(' '))
pebbles = map(int, input().split())
_ans = 0
for x in pebbles:
	_ans = _ans + (x // k if x % k == 0 else x // k + 1)
_ans = _ans // 2 if _ans % 2 == 0 else _ans // 2 + 1
print(_ans)


from math import ceil
(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
i = 0
u = 0
days = 0
while i < n:
	if l[i] >= 2 * m:
		days += l[i] // (2 * m)
		b = l[i] % (2 * m)
		if b > m:
			days += 1
		elif b != 0:
			u += 1
	elif l[i] > m:
		days += 1
	else:
		u += 1
	i += 1
print(days + ceil(u / 2))


import math
(n, k) = [int(x) for x in input().split()]
l = list(map(int, input().split()))
c = 0
i = 0
while 1:
	if i == n:
		break
	temp = math.ceil(l[i] / k)
	c += temp
	i += 1
c = math.ceil(c / 2)
print(c)


from math import ceil
(n, k) = map(int, input().split())
arr = map(int, input().split())
s = 0
for p in arr:
	s += ceil(p / k)
print(ceil(s / 2))


import math
(n, k) = map(int, input().split())
pockets = 0
w = map(int, input().split(' '))
for i in w:
	pockets = pockets + math.ceil(i / k)
print(math.ceil(pockets / 2))


from math import ceil
(n, k) = map(int, input().split())
weights = map(int, input().split())
answer = ceil(sum((ceil(weight / k) for weight in weights)) / 2)
print(answer)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
x = 0
for i in range(n):
	x += (a[i] + k - 1) // k
print((x + 1) // 2)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
t = 0
t1 = 0
for i in range(n):
	if l[i] >= 2 * k:
		r = l[i] // (2 * k)
		l[i] = l[i] % (2 * k)
		t = t + r
for i in range(n):
	if l[i] > k:
		r = l[i] // k
		l[i] = 0
		t = t + r
for i in range(n):
	if l[i] <= k and l[i] != 0:
		t1 = t1 + 1
if t1 % 2 == 1:
	print(t + t1 // 2 + 1)
else:
	print(t + t1 // 2)


import math
(n, k) = map(int, input().split())
line = map(int, input().split())
cnt = 0
for x in line:
	cnt += math.ceil(x / k)
print(math.ceil(cnt / 2))


import math
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = 0
for i in a:
	s = s + math.ceil(i / k)
print(math.ceil(s / 2))


(N, K) = map(int, input().split())
W = map(int, input().split())
print((sum(((i + K - 1) // K for i in W)) + 1) // 2)


import math
line = input()
(pebble_types, pocket_size) = line.split()
(pebble_types, pocket_size) = (int(pebble_types), int(pocket_size))
line = input()
a = [int(i) for i in line.split()]
total = 0
for i in a:
	total = total + math.ceil(i / pocket_size)
print(math.ceil(total / 2))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
num = 0
for i in range(n):
	num += a[i] // k
	num += int(a[i] % k != 0)
print(num // 2 + int(num % 2 != 0))


from math import ceil
(n, k) = map(int, input().split())
w = list(map(int, input().split()))
days = 0
for i in w:
	days += ceil(i / k)
print(ceil(days / 2))


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
su = 0
for i in range(n):
	cnt += A[i] // (2 * k)
	A[i] = A[i] % (2 * k)
for i in range(n):
	su += (A[i] + k - 1) // k
print(cnt + (su + 1) // 2)


from sys import stdin
import math
(N, K) = map(int, stdin.readline().split())
pebbles = list(map(int, stdin.readline().split()))
print(math.ceil(sum((math.ceil(p / K) for p in pebbles)) / 2))


from math import ceil
(n, k) = map(int, input().split())
w = list(map(int, input().split()))
for x in range(n):
	if w[x] % k == 0:
		w[x] //= k
	else:
		w[x] //= k
		w[x] += 1
print(ceil(sum(w) / 2))


(n, k) = map(int, input().split())
ip = list(map(int, input().split()))
count = 0
for i in ip:
	if i % k == 0:
		count += i // k
	else:
		count += i // k + 1
if count % 2 == 0:
	print(count // 2)
else:
	print(count // 2 + 1)


from sys import stdin, stdout
(n, k) = map(int, stdin.readline().split())
values = list(map(int, stdin.readline().split()))
cnt = 0
for i in range(n):
	cnt += values[i] // k + (values[i] % k != 0)
stdout.write(str(cnt // 2 + (cnt % 2 != 0)))


from math import ceil
(n, k) = map(int, input().split())
w = map(int, input().split())
pocket_travels = [ceil(i / k) for i in w]
days = ceil(sum(pocket_travels) / 2)
print(days)


(n, k) = (int(i) for i in input().split())
w = [int(i) for i in input().split()]
counter = 0
freecm = 2
for cur in w:
	d = cur // k + (cur % k != 0)
	if freecm == 2:
		counter += d // 2
		if d % 2 != 0:
			freecm = 1
	else:
		counter += d // 2
		if d % 2 != 0:
			counter += 1
			freecm = 2
if freecm == 1:
	counter += 1
print(counter)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def main():
	(n, k) = LI()
	r = 0
	for c in LI():
		r += (c + k - 1) // k
	return (r + 1) // 2
print(main())


from math import ceil as ce
from bisect import bisect_right as br
(n, k) = map(int, input().split())
w = sorted(list(map(int, input().split())))
ans = 0
si = br(w, k)
if si % 2:
	ans += ce(si / 2)
	ch = 1
else:
	ch = 0
	ans += si // 2
di = br(w, 2 * k)
ans += di - si
nos = 0
for i in range(di, n):
	nos += ce(w[i] / k)
if nos > 0:
	nos -= ch
ans += ce(nos / 2)
print(ans)


from sys import maxsize, stdout, stdin, stderr
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
S = lambda : stdin.readline().replace('\n', '').strip()

def debug(*args, c=6):
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=stderr)
stpr = lambda x: stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
from collections import defaultdict, Counter
from math import gcd
from bisect import bisect_left
from math import floor, ceil
(n, k) = tup()
ls = lint()
cnt = 0
for i in range(n):
	ls[i] = ceil(ls[i] / k)
print(ceil(sum(ls) / 2))


import math
(n, k) = map(int, input().split())
w = list(map(int, input().split()))
c = 0
for i in range(n):
	c += (w[i] + k - 1) // k
print((c + 1) // 2)


(n, k) = map(int, input().split())
l = [int(i) for i in input().split()]
from math import ceil
s = 0
for i in l:
	s += ceil(i / k)
print(ceil(s / 2))


a1 = input()
b1 = input()
L1 = a1.split()
n = int(L1[0])
k = int(L1[1])
L2 = b1.split()
w = []
for i in L2:
	w.append(int(i))
s = 0
for i in w:
	if i % k == 0:
		a = i // k
	else:
		a = i // k + 1
	s += a
if s % 2 == 0:
	ans = s // 2
else:
	ans = s // 2 + 1
print(ans)


(n, k) = map(int, input().split())
days = 0
w = list(map(int, input().split()))
for wi in w:
	days += (wi - 1) // k + 1
print((days - 1) // 2 + 1)


def f(l1, l2):
	(n, k) = l1
	ps = sum([(w + k - 1) // k for w in l2])
	return (ps + 1) // 2
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
print(f(l1, l2))


spam = input()
spam = spam.split(' ')
n = int(spam[0])
k = int(spam[1])
spam = input()
spam = spam.split(' ')
count = 0
for i in range(n):
	w = int(spam[i])
	count = count + w // k
	w = w - w // k * k
	if w > 0:
		count = count + 1
ans = count // 2
if count == 2 * ans:
	print(ans)
else:
	print(ans + 1)


from math import *
(n, k) = map(int, input().split())
(*m,) = map(int, input().split())
d = 0.0
for i in m:
	d += ceil(i / k)
print(ceil(d / 2))


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


(n, k) = (int(v) for v in input().split())
w = list((int(v) for v in input().split()))
up = lambda a, d: a // d + (1 if a % d else 0)
print(up(sum((up(v, k) for v in w)), 2))


def main():
	(n, k) = [int(x) for x in input().split()]
	pebbles = [int(x) for x in input().split()]
	lt = 0
	gt = 0
	ans = 0
	for x in pebbles:
		if x <= k:
			lt += 1
		else:
			lt += x // k
			if x % k != 0:
				lt += 1
	ans += lt // 2
	lt = lt % 2
	if lt == 1:
		ans += 1
	print(ans)
	return
main()


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
divk = 0
for e in arr:
	(d, m) = divmod(e, k)
	if m != 0:
		d += 1
	divk += d
print((divk + 1) // 2)


import math
(n, k) = [int(i) for i in input().split(' ')]
l = [math.ceil(int(i) / k) for i in input().split(' ')]
print(math.ceil(sum(l) / 2))


from functools import reduce
(_, k) = list(map(int, input().split()))
print((reduce(lambda x, y: x + (y + k - 1) // k, map(int, input().split()), 0) + 1) // 2)


(N, B) = map(int, input().split())
W = [int(x) for x in input().split()]
ans = 0
for b in W:
	if b % B == 0:
		ans += b // B
	else:
		ans += b // B + 1
if ans % 2 == 0:
	print(ans // 2)
else:
	print(ans // 2 + 1)


import math
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
x = []
c = 0
for i in l:
	if i <= k:
		x.append(i)
	elif i > k and i <= 2 * k:
		c = c + 1
	else:
		c = c + i // (2 * k)
		if i % (2 * k) == 0:
			continue
		elif i % (2 * k) > k:
			c = c + 1
		else:
			x.append(i % (2 * k))
c = c + (len(x) + 1) // 2
print(c)


from math import ceil
l = 0
(n, k) = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
for i in arr:
	l += ceil(i / k)
print(ceil(l / 2))


z = input()
z = z.split()
n = int(z[0])
k = int(z[1])
a = []
c = []
z = input()
z = z.split()
for i in range(n):
	b = int(z[i])
	a.append(b)
for i in a:
	if i % k == 0:
		b = i // k
		c.append(b)
	else:
		b = i // k + 1
		c.append(b)
d = sum(c)
if d % 2 == 0:
	print(d // 2)
else:
	print(d // 2 + 1)


(n, k) = map(int, input().split())
w = list(map(int, input().split()))
days = 0
heaps = 0
temp = 0
for i in range(n):
	heaps = w[i] // k
	if w[i] % k != 0:
		heaps += 1
	days += (heaps + temp) // 2
	if (heaps + temp) % 2 != 0:
		temp = 1
	else:
		temp = 0
print(days + temp)


(n, k) = map(int, input().split())
l = sorted(map(int, input().split()))
ans = 0
for i in range(n):
	ans += -(-l[i] // k)
print(-(-ans // 2))


(n, k) = map(int, input().split())
w = list(map(int, input().split()))
r = sum(map(lambda x: (x + k - 1) // k, w))
print((r + 1) // 2)


read = lambda : map(int, input().split())
(n, k) = read()
w = list(read())
cnt = sum(((i - 1) // k + 1 for i in w))
ans = (cnt + 1) // 2
print(ans)


from math import ceil
(n, k) = list(map(int, input().split()))
w = list(map(int, input().split()))
d = 0
for i in w:
	d += ceil(i / k) * 0.5
print(int(ceil(d)))


import sys, math
sys.setrecursionlimit(10 ** 8)
(n, k) = map(int, input().split())
lst = list(map(int, input().split()))
s = 0
for i in range(n):
	s += math.ceil(lst[i] / k)
print(math.ceil(s / 2))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
i = 0
ans = 0
while i < n:
	if a[i] > 2 * k:
		if a[i] % (2 * k) == 0:
			ans += a[i] // (2 * k)
			i += 1
		elif a[i] % (2 * k) > k:
			ans += a[i] // (2 * k) + 1
			i += 1
		elif i < n - 1 and a[i + 1] > k:
			a[i + 1] -= k
			ans += a[i] // (2 * k) + 1
			i += 1
		else:
			ans += a[i] // (2 * k) + 1
			i += 2
	elif a[i] > k:
		ans += 1
		i += 1
	elif i < n - 1 and a[i + 1] > k:
		a[i + 1] -= k
		ans += 1
		i += 1
	else:
		ans += 1
		i += 2
print(ans)


import math as mt
import sys, string, bisect
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
(n, k) = M()
l = L()
ans = 0
for i in range(n):
	ans += mt.ceil(l[i] / k)
print(int(mt.ceil(ans / 2)))


import math as mt
import sys
import bisect
input = sys.stdin.readline

def takeSecond(elem):
	return elem[1]

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
t = 1
for _ in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		ans += mt.ceil(l[i] / k)
	print(mt.ceil(ans / 2))


import sys
input = sys.stdin.readline
(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
ans = 0
for i in range(n):
	ans += (a[i] - 1) // k + 1
print((ans - 1) // 2 + 1)


def ceil(a, b):
	return -(-a // b)
ip = lambda : [int(i) for i in input().split()]
(n, k) = ip()
L = ip()
ans = 0
for i in L:
	ans += ceil(i, k)
ans = ceil(ans, 2)
print(ans)


def kamni(lst, k):
	count1 = 0
	for i in range(len(lst)):
		count1 += lst[i] // k
		if lst[i] % k != 0:
			count1 += 1
	count2 = count1 // 2
	if count1 % 2 != 0:
		count2 += 1
	return count2
(n, K) = [int(i) for i in input().split()]
b = [int(j) for j in input().split()]
print(kamni(b, K))


import math
(n, k) = map(int, input().split())
w = map(int, input().split())
res = 0
for el in w:
	res += math.ceil(float(el) / k)
print(math.ceil(float(res) / 2))


(n, k) = map(int, input().split())
arr = map(int, input().split())
from math import ceil
pockets = 0
for i in arr:
	pockets += ceil(i / k)
print(ceil(pockets / 2))


import math
(n, k) = list(map(int, input().split(' ')))
w = list(map(lambda x: math.ceil(int(x) / k), input().split(' ')))
ans = math.ceil(sum(w) / 2)
print(ans)


(n, k) = map(int, input().split())
lst = list(map(int, input().split()))
print((sum(((val + k - 1) // k for val in lst)) + 1) // 2)


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


import itertools
import math
from collections import defaultdict

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

def solve():
	(n, k) = input_ints()
	a = input_ints()
	ans = 0
	for x in a:
		ans += (x + k - 1) // k
	ans = (ans + 1) // 2
	print(ans)
solve()


import math
(n, m) = map(int, input().split())
p = 0
val = map(int, input().split())
for v in val:
	p += math.ceil(v / m)
print(math.ceil(p / 2))


(n, k) = map(int, input().split())
w = list(map(int, input().split()))
nbPkt = 0
for i in w:
	nbPkt += (i + k - 1) // k
print((nbPkt + 1) // 2)


def solve():
	(n, k) = map(int, input().split())
	w = [int(i) for i in input().split()]
	ans = sum(((wi + k - 1) // k for wi in w))
	ans = (ans + 1) // 2
	print(ans)
solve()


(n, k) = map(int, input().split())
r = 0
for x in map(int, input().split()):
	r += 0 - -x // k
print(0 - -r // 2)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
pocketfuls = 0
for x in a:
	if x % k == 0:
		pocketfuls += x // k
	else:
		pocketfuls += x // k + 1
if pocketfuls % 2 == 0:
	print(pocketfuls // 2)
else:
	print(pocketfuls // 2 + 1)


from math import *
(n, m) = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
for i in range(n):
	if l[i] <= m:
		ans += 0.5
	elif l[i] // m % 2 == 0:
		if l[i] % m == 0:
			ans += l[i] // m // 2
		else:
			ans += l[i] // m // 2 + 0.5
	elif l[i] % m == 0:
		ans += l[i] // m // 2 + 0.5
	else:
		ans += l[i] // m // 2 + 1
print(ceil(ans))


import math
(n, k) = map(int, input().split())
p = list(map(int, input().split()))
days = 0
k1 = 0
q = []
for i in range(n):
	q.append(p[i] % k)
	days += p[i] // k
m = n - q.count(0)
print(math.ceil((m + days) / 2))


import math
(n, k) = map(int, input().split())
arr = [int(i) for i in input().split()]
arr.sort()
ans = 0
for i in range(len(arr)):
	temp = math.ceil(arr[i] / k)
	ans += temp
print(math.ceil(ans / 2))


(x, y) = input().split(' ')
(x, y) = (int(x), int(y))
total = 0
ml = list(input().split(' '))
for i in ml:
	a = int(i)
	total = total + a // y
	if a % y > 0:
		total += 1
total = total % 2 + total // 2
print(total)


(n, k) = map(int, input().split())
import math
l = list(map(int, input().split()))
j = []
for i in l:
	j.append(math.ceil(i / k))
print(math.ceil(sum(j) / 2))


(n, k) = map(int, input().split())
wi = list(map(int, input().split()))
days = 0.0
k2 = 2 * k
for w in wi:
	if w % k == 0:
		days += w // k * 0.5
	else:
		days += (1 + w // k) * 0.5
days = int(days) if days == int(days) else int(days) + 1
print(days)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
k = 0
k1 = 0
for i in range(n - 1, -1, -1):
	k = k + l[i] // (m * 2)
	l[i] = l[i] % (m * 2)
	if l[i] != 0:
		if l[i] >= m:
			l[i] = l[i] - m
			k1 = k1 + 1
st = n - l.count(0)
if (k1 + st) % 2 == 0:
	k = k + (k1 + st) // 2
else:
	k = k + 1 + (k1 + st) // 2
print(k)


import math
(n, k) = map(int, input().split())
li = list(map(int, input().strip().split()))[:n]
total = 0
for i in li:
	temp = math.ceil(i / k)
	total += temp
ans = math.ceil(total / 2)
print(ans)


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
i = 0
p = 0
for u in a:
	if u // (2 * k) >= 1:
		i += u // (2 * k)
		if u % (2 * k) <= k and u % (2 * k) != 0 and (p == 0):
			p += 1
		elif u % (2 * k) != 0 and u % (2 * k) <= k and (p == 1):
			i += 1
			p = 0
		elif u % (2 * k) > k:
			i += 1
	elif u <= k and u != 0 and (p == 0):
		p += 1
	elif u != 0 and u <= k and (p == 1):
		i += 1
		p = 0
	elif u > k:
		i += 1
if p == 1:
	print(i + 1)
else:
	print(i)


(_, k) = map(int, input().split())
s = list(map(int, input().split()))
n = 0
for i in range(len(s)):
	n += s[i] // k + (s[i] % k > 0)
print(n // 2 + (n % 2 > 0))


(n, k) = map(int, input().split(' '))
s = list(map(int, input().split(' ')))
r = [(x + k - 1) // k for x in s]
r = sum(r)
res = (r + 1) // 2
print(res)


import math
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
for i in b:
	c.append(math.ceil(i / a[1]))
print(math.ceil(sum(c) / 2))


(n, k) = map(int, input().split())
w = list(map(int, input().split()))
import math
s = sum((math.ceil(wi / k) for wi in w))
print(int(math.ceil(s / 2)))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
print((sum([(a[i] + k - 1) // k for i in range(n)]) + 1) // 2)


import math

class CodeforcesTask789ASolution:

	def __init__(self):
		self.result = ''
		self.n_k = []
		self.w = []

	def read_input(self):
		self.n_k = [int(x) for x in input().split(' ')]
		self.w = [int(x) for x in input().split(' ')]

	def process_task(self):
		pockets = [math.ceil(x / self.n_k[1]) for x in self.w]
		self.result = str(int(math.ceil(sum(pockets) / 2)))

	def get_result(self):
		return self.result
Solution = CodeforcesTask789ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


def mapit():
	temp = list(map(int, input().split()))
	return temp
import math

def solution():
	(n, k) = mapit()
	arr = mapit()
	ans = 0
	for i in range(n):
		tp = math.ceil(arr[i] / k)
		ans += tp
	ans = math.ceil(ans / 2)
	print(int(ans))
	return
solution()


(n, k) = map(int, input().split())
ws = list(map(int, input().split()))
sum = 0
for i in range(n):
	sum += ws[i] // k + (ws[i] % k > 0)
print(sum // 2 + (sum % 2 > 0))


import math
(n, k) = map(int, input().split())
l_p = list(map(int, input().split()))
t = 0
for p in l_p:
	t += math.ceil(p / k)
print(math.ceil(t / 2))


(n, k) = map(int, input().split())
w = list(map(int, input().split()))
a = 0
count = 0
for i in range(n):
	a += (w[i] + k - 1) // k
	count = (a + 1) // 2
print(count)


from math import ceil
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
day = 0
b1 = b2 = odd = 0
for i in range(n):
	yy = ceil(a[i] / k)
	if yy % 2 == 0:
		day += yy // 2
	else:
		odd += 1
		day += ceil(yy / 2)
print(day - odd // 2)


from math import ceil
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
for i in range(n):
	l[i] = ceil(l[i] / k)
print(ceil(sum(l) / 2))


from sys import stdin
from math import ceil
(_, k) = map(int, stdin.readline().rstrip().split())
peps = list(map(int, stdin.readline().rstrip().split()))
for (index, item) in enumerate(peps):
	peps[index] = ceil(item / k)
print(ceil(sum(peps) / 2))


(n, k) = map(int, input().split())
L = list(map(int, input().split()))
t = 0
for l in L:
	t += l // k
	if l % k != 0:
		t += 1
if t % 2 == 0:
	print(t // 2)
else:
	print(t // 2 + 1)


parameters = [int(i) for i in input().split()]
pebbles = [int(i) for i in input().split()]
n = parameters[0]
k = parameters[-1]
counter = 0
for pebble in pebbles:
	x = pebble / k
	if x > int(x):
		counter += int(x) + 1
	else:
		counter += int(x)
days = counter / 2
if days > int(days):
	print(int(days + 1))
else:
	print(int(days))


from math import ceil
(n, k) = map(int, input().split())
w = [0] + list(map(int, input().split()))
minDay = 0
total = 0
for i in range(1, n + 1):
	total += ceil(w[i] / k)
minDay = ceil(total / 2)
print(minDay)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
help = 0
for i in a:
	help += i // k
	if i % k != 0:
		help += 1
if help % 2 != 0:
	help += 1
help = help // 2
print(help)


st = input().split(' ')
st1 = input().split(' ')
for p in range(2):
	st[p] = int(st[p])
for p in range(st[0]):
	st1[p] = int(st1[p])
st2 = []
st3 = []
for i in range(st[0]):
	st2.append(st1[i] % (2 * st[1]))
	st1[i] = st1[i] // (2 * st[1])
for i in range(st[0]):
	st3.append(st2[i] % st[1])
	st2[i] = st2[i] // st[1]
count2 = 0
sum = 0
sum1 = 0
for i in range(st[0]):
	if st3[i] != 0:
		count2 = count2 + 1
	sum = sum + st1[i]
	sum1 = sum1 + st2[i]
coun = sum + (sum1 + count2) // 2 + (sum1 + count2) % 2
print(coun)


from math import ceil
[n, k] = [int(x) for x in input().split()]
w = [ceil(int(x) / k) for x in input().split()]
res = ceil(sum(w) / 2)
print(res)


(_, k) = map(int, input().split())
print((sum(((w + k - 1) // k for w in map(int, input().split()))) + 1) // 2)


import sys, heapq
(n, k) = map(int, sys.stdin.readline().split())
arr = list(map(int, sys.stdin.readline().split()))
ans = []
for i in arr:
	ans.append(i // k if i % k == 0 else i // k + 1)
print(sum(ans) // 2 if sum(ans) % 2 == 0 else sum(ans) // 2 + 1)


import sys

def solve():
	(n, k) = map(int, input().split())
	w = [int(i) for i in input().split()]
	ans = 0
	for i in range(n):
		ans += w[i] // (2 * k)
		w[i] -= w[i] // (2 * k) * 2 * k
	w.sort()
	for i in range(n):
		if w[i] == 0:
			continue
		elif w[i] <= k:
			if i < n - 1 and w[i + 1] <= k:
				ans += 1
				w[i] = w[i + 1] = 0
			else:
				ans += 1
				w[i] = 0
		else:
			ans += 1
	print(ans)

def debug(x, table):
	for (name, val) in table.items():
		if x is val:
			print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
			return None
solve()