Polycarp invited all his friends to the tea party to celebrate the holiday. He has n cups, one for each of his n friends, with volumes a_1, a_2, ..., a_{n}. His teapot stores w milliliters of tea (w ≤ a_1 + a_2 + ... + a_{n}). Polycarp wants to pour tea in cups in such a way that:  Every cup will contain tea for at least half of its volume  Every cup will contain integer number of milliliters of tea  All the tea from the teapot will be poured into cups  All friends will be satisfied. 

Friend with cup i won't be satisfied, if there exists such cup j that cup i contains less tea than cup j but a_{i} > a_{j}.

For each cup output how many milliliters of tea should be poured in it. If it's impossible to pour all the tea and satisfy all conditions then output -1.


-----Input-----

The first line contains two integer numbers n and w (1 ≤ n ≤ 100, $1 \leq w \leq \sum_{i = 1}^{n} a_{i}$).

The second line contains n numbers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ 100).


-----Output-----

Output how many milliliters of tea every cup should contain. If there are multiple answers, print any of them.

If it's impossible to pour all the tea and satisfy all conditions then output -1.


-----Examples-----
Input
2 10
8 7

Output
6 4 

Input
4 4
1 1 1 1

Output
1 1 1 1 

Input
3 10
9 8 10

Output
-1



-----Note-----

In the third example you should pour to the first cup at least 5 milliliters, to the second one at least 4, to the third one at least 5. It sums up to 14, which is greater than 10 milliliters available.

Difficulty: MEDIUM

Solutions:
import math
(n, w) = map(int, input().split())
volumes = []
possible = True
teacups = [0] * n
vals = list(map(int, input().split()))
for i in range(n):
	poured = math.ceil(vals[i] / 2)
	w -= poured
	if w < 0:
		possible = False
		break
	volumes.append((vals[i], i))
	teacups[i] = poured
if not possible:
	print(-1)
else:
	svolumes = sorted(volumes, reverse=True)
	for j in svolumes:
		extra = j[0] - teacups[volumes.index(j)]
		if w - extra < 0:
			teacups[j[1]] += w
			break
		w -= extra
		teacups[j[1]] += extra
	print(' '.join((str(t) for t in teacups)))


from math import ceil

def selected_sum(l, p):
	r = 0
	for i in l:
		r += l[p]
	return r

def solve(n, w, a):
	(l, s) = ([], [])
	for i in range(n):
		l.extend([ceil(a[i] / 2)])
	dif = w - sum(l)
	if dif < 0:
		return -1
	for i in range(n):
		for j in range(i):
			if a[i] > a[j] and l[i] < l[j]:
				s.append([l[j] - l[i], i])
	if selected_sum(s, 0) > dif:
		return -1
	for k in s:
		l[k[1]] += k[0]
	S = [i[0] for i in sorted(enumerate(a), key=lambda x: x[1])]
	dif = w - sum(l)
	if dif < 0:
		return -1
	if dif == 0:
		return l
	while sum(l) != w:
		if l[S[i]] < A[S[i]]:
			l[S[i]] += min(A[S[i]] - l[S[i]], dif)
			dif = w - sum(l)
			if i == 0 and dif > 0:
				return -1
			i -= 1
	return l
(N, W) = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
if solve(N, W, A) == -1:
	print(solve(N, W, A))
else:
	for (i, item) in enumerate(solve(N, W, A)):
		if i != len(solve(N, W, A)) - 1:
			print(str(item) + ' ', end='')
		else:
			print(item)


def solve():
	(n, w) = map(int, input().split())
	a = list(map(int, input().split()))
	mp = [[a[i], i] for i in range(n)]
	mp.sort()
	ans = [[mp[i][1], 0] for i in range(n)]
	mi = 0
	for i in range(n):
		t = max(mi, mp[i][0] // 2 + mp[i][0] % 2)
		ans[i][1] = t
		w -= t
		mi = t
	if w < 0:
		print(-1)
	else:
		for i in range(-1, -n - 1, -1):
			if w > mp[i][0] - ans[i][1]:
				w -= mp[i][0] - ans[i][1]
				ans[i][1] = mp[i][0]
			else:
				ans[i][1] += w
				break
		ans.sort()
		for i in range(n):
			print(ans[i][1], end=' ')
solve()


(n, w) = (int(i) for i in input().split())
mas = [int(i) for i in input().split()]

def qer():
	global w
	for (i, size) in enumerate(mas):
		q = round(size / 2 + 0.1)
		rer[size, i] = q
		w -= q
		if w < 0:
			return {1: -1}
	for (size, i) in sorted(rer, reverse=True):
		o = size - rer[size, i]
		rer[size, i] += min(w, o)
		w -= min(o, w)
		if w == 0:
			break
	return rer
rer = {}
print(*qer().values())


(n, w) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a_index = [(x, i) for (i, x) in enumerate(a)]
a_index.sort(reverse=True)
res = [0] * len(a)
for (x, i) in a_index:
	need = (x + 1) // 2
	res[i] = need
	w -= need
	if w < 0:
		print(-1)
		return
if w > 0:
	for (x, i) in a_index:
		if w == 0:
			break
		need = min(w, x - res[i])
		res[i] += need
		w -= need
print(res[0], end='')
for i in range(1, len(res)):
	print(' ' + str(res[i]), end='')
print()


(n, w) = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]
b = [elem // 2 + elem % 2 for elem in a]
if sum(b) > w:
	print(-1)
elif sum(b) == w:
	print(' '.join([str(e) for e in b]))
else:
	for i in range(len(a)):
		a[i] = [a[i], i]
	a.sort(reverse=True)
	d = w - sum(b)
	i = 0
	while d > 0:
		j = a[i][1]
		m = min(d, a[i][0] - b[j])
		b[j] += m
		d -= m
		i += 1
	print(' '.join([str(e) for e in b]))


import sys

def drinking(n, w, a):
	if sum(a) / 2 > w:
		print(-1)
		sys.exit()
	sorted_a = []
	for i in range(len(a)):
		sorted_a.append([i, a[i]])
	sorted_a = sorted(sorted_a, key=lambda tup: tup[1])
	for i in range(len(sorted_a)):
		if sorted_a[i][1] // 2 * 2 >= sorted_a[i][1]:
			w -= sorted_a[i][1] // 2
			sorted_a[i][1] -= sorted_a[i][1] // 2
		else:
			w -= sorted_a[i][1] // 2 + 1
			sorted_a[i][1] -= sorted_a[i][1] // 2 + 1
	i = len(sorted_a) - 1
	if w < 0:
		print(-1)
		sys.exit()
	while w > 0:
		if w >= sorted_a[i][1]:
			w -= sorted_a[i][1]
			sorted_a[i][1] = 0
		if w < sorted_a[i][1]:
			sorted_a[i][1] -= w
			w = 0
		if i > 0:
			i -= 1
		else:
			i = len(sorted_a) - 1
	sorted_a = sorted(sorted_a, key=lambda tup: tup[0])
	for i in range(len(sorted_a)):
		a[i] -= sorted_a[i][1]
	for i in range(len(a)):
		if a[i] == 0:
			print(-1)
			sys.exit()
	return a
(n, w) = map(int, input().split())
a = [int(i) for i in input().split()]
result = ' '.join(map(str, drinking(n, w, a)))
print(result)


from sys import stdin, stdout
(n, w) = map(int, stdin.readline().strip().split())
arr = sorted([(int(num), i) for (i, num) in enumerate(stdin.readline().strip().split())], key=lambda t: t[0], reverse=False)
outputs = [-1] * n
condn = True
for i in arr:
	req = i[0] // 2 if i[0] % 2 == 0 else i[0] // 2 + 1
	if req <= w:
		w -= req
		outputs[i[1]] = req
	else:
		condn = False
		break
if condn:
	for i in range(n - 1, -1, -1):
		req = arr[i][0] // 2
		if w == 0:
			break
		outputs[arr[i][1]] += min(req, w)
		w -= min(req, w)
	stdout.write(' '.join(list(map(str, outputs))))
else:
	stdout.write('-1')


(n, totaltea) = map(int, input().split())
ar = list(map(int, input().split()))
ans = [0] * n
for i in range(n):
	ans[i] = (ar[i] + 1) // 2
if sum(ans) > totaltea:
	print(-1)
else:
	for i in range(n):
		ar[i] = [ar[i], i]
	ar = sorted(ar)[::-1]
	remain = totaltea - sum(ans)
	for i in range(n):
		if remain == 0:
			break
		k = min(remain, ar[i][0] - ans[ar[i][1]])
		ans[ar[i][1]] += k
		remain -= k
	if remain != 0:
		print(-1)
	else:
		print(*ans)


f = lambda : map(int, input().split())
(n, w) = f()
t = list(f())
if sum(t) < w:
	print(-1)
else:
	p = [(a + 1) // 2 for a in t]
	d = w - sum(p)
	if d < 0:
		print(-1)
	else:
		p = sorted(zip(t, p, range(n)))
		for (a, b, i) in p[::-1]:
			if d == 0:
				t[i] = b
			elif a > b + d:
				(d, t[i]) = (0, b + d)
			else:
				d -= a - b
		print(' '.join(map(str, t)))


(n, chainik) = map(int, input().split(' '))
chashki = list(map(int, input().split(' ')))
nalito = {}

def nalit():
	global chainik
	for (i, razmer) in enumerate(chashki):
		tmp = int(round(razmer / 2 + 0.1))
		nalito[razmer, i] = tmp
		chainik -= tmp
		if chainik < 0:
			return [-1]
	for (razmer, i) in sorted(nalito, reverse=True):
		ostatok = razmer - nalito[razmer, i]
		pribvaka = min(ostatok, chainik)
		nalito[razmer, i] += pribvaka
		chainik -= pribvaka
		if chainik == 0:
			break
	return [nalito[razmer, i] for (i, razmer) in enumerate(chashki)]
print(*nalit())


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
d = dict()
for (i, ai) in enumerate(a):
	d[ai, i] = (ai + 1) // 2
s = sum(d.values())
if w < s:
	print(-1)
else:
	delta = w - s
	for (ai, i) in sorted(d.keys())[::-1]:
		dai = ai - d[ai, i]
		d1 = min(delta, dai)
		d[ai, i] += d1
		delta -= d1
		if delta <= 0:
			break
	b = [0] * n
	for (ai, i) in d:
		b[i] = d[ai, i]
	print(' '.join(map(str, b)))


import sys
from itertools import accumulate

def solve():
	(n, w) = map(int, input().split())
	a = [int(i) for i in input().split()]
	b = [0] * n
	for (i, ai) in enumerate(a):
		tmp = (ai + 1) // 2
		w -= tmp
		b[i] += tmp
		if w < 0:
			print(-1)
			return
	ag = [(ai, i) for (i, ai) in enumerate(a)]
	ag.sort(reverse=True)
	for i in range(n):
		v = ag[i][0]
		k = ag[i][1]
		rem = v - b[k]
		if w > rem:
			w -= rem
			b[k] = v
		else:
			b[k] += w
			break
	print(*b)

def __starting_point():
	solve()
__starting_point()


import sys
from bisect import bisect_left as lb
from collections import deque
from queue import PriorityQueue as pq
from math import *
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
inv = lambda x: pow(x, mod - 2, mod)
mod = 10 ** 9 + 7
(n, w) = il()
a = il()
s = 0
for i in a:
	s += -(-i // 2)
if w < s:
	print(-1)
	exit(0)
ans = [0 for i in range(n)]
b = []
for i in range(n):
	ans[i] = -(-a[i] // 2)
	w -= ans[i]
	b.append([a[i], i])
b.sort(reverse=True)
for i in range(n):
	mx = min(w, b[i][0] - ans[b[i][1]])
	ans[b[i][1]] += mx
	w -= mx
	if w <= 0:
		break
print(*ans)


def find(A, w):
	B = [(A[i], i) for i in range(len(A))]
	B = sorted(B)
	A = sorted(A)
	dp = [0] * len(A)
	dp[0] = (A[0] + 1) // 2
	w -= dp[0]
	for i in range(1, len(dp)):
		dp[i] = max(dp[i - 1], (A[i] + 1) // 2)
		if dp[i] > A[i]:
			return [-1]
		w -= dp[i]
	if w < 0:
		return [-1]
	for i in range(len(dp) - 1, -1, -1):
		if w > 0:
			add = min(w, A[i] - dp[i])
			dp[i] += add
			w -= add
	ans = [0] * len(A)
	for i in range(len(B)):
		ans[B[i][1]] = dp[i]
	return ans
(n, w) = list(map(int, input().strip().split(' ')))
A = list(map(int, input().strip().split(' ')))
print(*find(A, w))


(n, w) = map(int, input().split())
arr = list(map(float, input().split()))
r = sorted(list(range(n)), key=lambda x: arr[x])
ans = [0] * n
for i in r:
	crt = int((arr[i] + 1) // 2)
	ans[i] += crt
	w -= crt
if w < 0:
	print(-1)
	exit(0)
for i in reversed(r):
	crt = int(min(w, arr[i] - ans[i]))
	w -= crt
	ans[i] += crt
	if w == 0:
		break
print(' '.join(map(str, ans)))


(n, w) = map(int, input().split())
l = list(map(int, input().split()))
ans = []
for i in range(n):
	ans.append(l[i] // 2 + l[i] % 2)
	w -= l[i] // 2 + l[i] % 2
	l[i] = (l[i], i)
if w < 0:
	print(-1)
else:
	l = list(reversed(list(sorted(l))))
	for i in range(n):
		(w, ans[l[i][1]]) = (max(0, w - abs(ans[l[i][1]] - l[i][0])), min(l[i][0], ans[l[i][1]] + w))
		if w == 0:
			break
	for i in range(n):
		print(ans[i], end=' ')


f = input().split()
(n, w) = (int(f[0]), int(f[1]))
(l, v) = ([], [])
v = [int(x) for x in input().split()]
for i in range(0, n):
	l.append([v[i], int(0), i])
l.sort()
i = n - 1
while i >= 0:
	x = int(l[i][0] / 2) + int(l[i][0] % 2)
	l[i][1] += x
	w -= x
	i -= 1
if w < 0:
	print(-1)
else:
	i = n - 1
	while i >= 0:
		x = l[i][0] - l[i][1]
		if x > 0 and w > 0:
			if w - x >= 0:
				l[i][1] += x
				w -= x
			else:
				l[i][1] += w
				w = 0
		(l[i][0], l[i][2]) = (l[i][2], l[i][0])
		i -= 1
	l.sort()
	for x in l:
		print(x[1], end=' ')


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
s = 0
for i in a:
	s += (i + 1) // 2
if s > w:
	print(-1)
else:
	ml = []
	diff = sum(a) - w
	j = 1
	for i in a:
		ml.append([i, j])
		j += 1
	ml.sort()
	f = 0
	while diff > 0:
		for i in ml:
			minq = (i[0] + 1) // 2
			curr = i[0]
			sub = min(diff, curr - minq)
			i[0] -= sub
			diff -= sub
			if diff <= 0:
				f = 1
				break
		if f == 1:
			break
	ml.sort(key=lambda x: x[1])
	for k in ml:
		print(k[0], end=' ')


import math
(n, w) = map(int, input().split())
A = list(map(int, input().split()))
B = [0] * n
sm = 0
for i in range(n):
	su = int(math.ceil(A[i] / 2))
	B[i] = (A[i], i, su)
	sm += su
if sm > w:
	print('-1')
else:
	rem = w - sm
	B = sorted(B, reverse=True)
	C = [0] * n
	for x in B:
		l = x[0] - x[2]
		if l <= rem:
			C[x[1]] = l + x[2]
			rem -= l
		else:
			C[x[1]] = rem + x[2]
			rem = 0
	ans = ''
	for i in range(n):
		ans += str(C[i]) + ' '
	print(ans)


l = input().split()
(n, w) = (int(l[0]), int(l[1]))
arr = list(map(int, input().split()))
sort = sorted([i for i in range(len(arr))], key=lambda x: arr[x])
ans = list(map(lambda x: x + (x & 1) >> 1, arr))
s = sum(ans)
if s <= w:
	r = w - s
	while r:
		x = sort.pop()
		y = min(arr[x] - ans[x], r)
		ans[x] += y
		r -= y
	print(' '.join(map(str, ans)))
else:
	print('-1')


from collections import deque as de
import math
from math import sqrt as sq
from math import floor as fl
from math import ceil as ce
from sys import stdin, stdout
import re
from collections import Counter as cnt
from functools import reduce
from itertools import groupby as gb
from bisect import bisect_left as bl, bisect_right as br

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

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

def binarytodecimal(n):
	return int(n, 2)

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

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

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def getProduct(n):
	product = 1
	while n != 0:
		product = product * (n % 10)
		n = n // 10
	return product

def lcm(x, y):
	lcm = x * y // math.gcd(x, y)
	return lcm

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def checkisap(list):
	d = list[1] - list[0]
	for i in range(2, len(list)):
		temp = list[i] - list[i - 1]
		if temp != d:
			return False
	return True

def primes_method5(n):
	out = {}
	sieve = [True] * (n + 1)
	for p in range(2, n + 1):
		if sieve[p]:
			out[p] = 1
			for i in range(p, n + 1, p):
				sieve[i] = False
	return out

def getSum(n):
	strr = str(n)
	list_of_number = list(map(int, strr.strip()))
	return sum(list_of_number)

def ceildiv(x, y):
	return (x + y - 1) // y

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

def ii():
	return int(input())

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

def si():
	return list(map(str, input()))

def indict():
	dic = {}
	for (index, value) in enumerate(input().split()):
		dic[int(value)] = int(index) + 1
	return dic

def frqdict():
	dic = {}
	for (index, value) in enumerate(input()):
		if value not in dic:
			dic[value] = 1
		else:
			dic[value] += 1
	return dic
(n, w) = di()
a = []
fuls = 0
halfs = 0
for (index, value) in enumerate(input().split()):
	fuls += int(value)
	halfs += ce(int(value) / 2)
	a.append(int(value))
if w < halfs:
	print(-1)
elif w == halfs:
	for i in range(n):
		print(ce(a[i] / 2), end=' ')
elif w == fuls:
	print(*a, sep=' ')
else:
	ans = []
	for i in range(n):
		ans.append([a[i], ce(a[i] / 2), i])
	ans.sort(reverse=True)
	diff = w - halfs
	ch = 1
	ans2 = []
	for i in range(n):
		if ch:
			halfele = ans[i][1]
			fulfele = ans[i][0]
			elediff = fulfele - halfele
			if diff > elediff:
				diff -= elediff
				ans[i][1] = fulfele
			elif diff == elediff:
				ans[i][1] = fulfele
				ch = 0
			else:
				ans[i][1] += diff
				ch = 0
		ans2.append([ans[i][2], ans[i][1]])
	ans2.sort()
	for i in range(n):
		print(ans2[i][1], end=' ')


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

def solve(n, w, a):
	res = [0] * n
	for (i, ai) in enumerate(a):
		if ai & 1:
			v = int(ceil(ai / 2))
		else:
			v = ai // 2
		if v <= w:
			res[i] = v
			w -= v
		else:
			return []
	for (i, ai) in enumerate(a):
		for (j, aj) in enumerate(a):
			if i == j or ai <= aj:
				continue
			if res[i] < res[j]:
				v = res[j] - res[i]
				if v <= w:
					res[i] += v
					w -= v
				else:
					return []
	if w == 0:
		return res
	res_sort = sorted([(r, i) for (i, r) in enumerate(a)], reverse=True)
	for (cur, idx) in res_sort:
		v = min(w, a[idx] - res[idx])
		res[idx] += v
		w -= v
	if w == 0:
		return res
	else:
		return []
(n, w) = map(int, input().split())
a = list(map(int, input().split()))
res = solve(n, w, a)
if res:
	print(*res)
else:
	print(-1)


(n, w) = map(int, input().split())
a = input().split()
a = [(int(a[i]), i) for i in range(n)]
a.sort()
o = [0] * n
for i in range(n):
	x = (a[i][0] + 1) // 2
	w -= x
	o[a[i][1]] += x
	if w < 0:
		print(-1)
		exit()
j = n - 1
while j >= 0 and w > 0:
	x = min(a[j][0] - o[a[j][1]], w)
	w -= x
	o[a[j][1]] += x
	j -= 1
if w != 0:
	print(-1)
	exit()
print(' '.join(map(str, o)))


import math

class Glass:

	def __init__(self, pos, size, fill=0):
		(self.s, self.p, self.f) = (size, pos, fill)
(n, w) = map(int, input().split())
gls = []
sizes = [int(i) for i in input().split()]
for i in range(n):
	g = Glass(i, sizes[i])
	l = math.ceil(g.s / 2)
	if w >= l:
		(g.f, w) = (l, w - l)
		gls.append(g)
	else:
		print(-1)
		exit(0)
gls.sort(key=lambda y: y.s)
for i in range(n - 1, -1, -1):
	emp = gls[i].s - gls[i].f
	if w > 0:
		gls[i].f += min(emp, w)
		w -= min(emp, w)
	else:
		break
gls.sort(key=lambda y: y.p)
for i in range(n):
	print(gls[i].f, end=' ')


import math
import sys
(n, w) = list(map(int, input().split()))
a = list(map(int, input().split()))
a = [[a[i], i] for i in range(len(a))]
a.sort()
a = a[::-1]
res = [0] * n
for i in range(n):
	if w >= math.ceil(a[i][0] / 2):
		res[i] += math.ceil(a[i][0] / 2)
		w -= math.ceil(a[i][0] / 2)
	else:
		print(-1)
		sys.exit(0)
for i in range(n):
	to_add = 0
	if w >= a[i][0] - res[i]:
		to_add = a[i][0] - res[i]
	else:
		to_add = w
	w -= to_add
	res[i] += to_add
sorted_res = [None] * n
for i in range(n):
	sorted_res[a[i][1]] = res[i]
print(' '.join(map(str, sorted_res)))


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
arr = []
ans = [0 for _ in range(n)]
for i in range(n):
	ans[i] += (a[i] + 1) // 2
	w -= (a[i] + 1) // 2
	arr.append((a[i], i))
if w < 0:
	print(-1)
else:
	arr = list(reversed(sorted(arr)))
	for (a, i) in arr:
		d = min(w, a - ans[i])
		ans[i] += d
		w -= d
	print(' '.join(map(str, ans)))


(n, w) = input().split()
n = int(n)
w = int(w)
l = list(map(int, input().split()))
a = []
s = 0
for i in range(0, n):
	a.append([l[i], i])
	s = s + (l[i] + 1) // 2
l.sort()
a.sort(key=lambda x: x[0])
for i in range(0, n):
	a[i][0] = (l[i] + 1) // 2
k = w - s
if k < 0:
	print(-1)
else:
	for i in range(n - 1, -1, -1):
		if k > l[i] - a[i][0]:
			k = k - l[i] + a[i][0]
			a[i][0] = l[i]
		else:
			a[i][0] += k
			k = 0
			break
	if k == 0:
		a.sort(key=lambda x: x[1])
		for i in range(0, n):
			print(a[i][0], end=' ')
	else:
		print('-1')


(n, w) = map(int, input().split())
A = list(map(int, input().split()))
order = sorted(range(n), key=lambda i: A[i])
A = list(map(lambda p: A[p], order))
use = [0 for _ in range(n)]
for i in range(n):
	use[i] = (A[i] + 1) // 2
	w -= use[i]
if w < 0:
	print(-1)
	exit()
for i in range(n)[::-1]:
	add = min(w, A[i] - use[i])
	w -= add
	use[i] += add
if w > 0:
	print(-1)
	exit()
ans = [0] * n
for i in range(n):
	ans[order[i]] = use[i]
for i in range(n):
	if i > 0:
		print(' ', end='')
	print(ans[i], end='')
print()


R = lambda : map(int, input().rstrip().split())
(n, w) = R()
a = list(R())
b = sorted(((v, i) for (i, v) in enumerate(a)))
half = 0
for x in a:
	half += (x + 1) // 2
if w < half:
	print(-1)
	exit()
ans = [0] * n
left = w - half
i = n - 1
while left > 0 and i >= 0:
	y = b[i]
	x = min(left, y[0] - (y[0] + 1) // 2)
	left -= x
	ans[y[1]] = x
	i -= 1
for i in range(n):
	ans[i] += (a[i] + 1) // 2
print(' '.join(map(str, ans)))


(n, w) = list(map(int, input().split()))
a = list(map(int, input().split()))
s = sum(a)
l = []
a2 = []
for i in range(n):
	a2.append([a[i], i])
a2.sort()

def m(x):
	if x % 2 == 1:
		return x // 2 + 1
	return x // 2

def f():
	if s / 2 > w:
		print(-1)
		return
	if w > s:
		print(-1)
		return
	t = m(a2[0][0])
	last = t
	l.append(t)
	for i in range(1, n):
		if last > a2[i][0]:
			print(-1)
			return
		if last < m(a2[i][0]):
			last = m(a2[i][0])
		t += last
		l.append(last)
	if t > w:
		print(-1)
		return
	add = w - t
	x = min(a2[-1][0] - l[-1], add)
	l[-1] += x
	add -= x
	last = l[-1]
	for i in range(n - 2, -1, -1):
		if add == 0:
			break
		x = min(a2[i][0], last)
		x = x - l[i]
		x = min(x, add)
		if x < 0:
			continue
		l[i] += x
		add -= x
	if add != 0:
		print(-1)
		return
	for i in range(n):
		for u in range(n):
			if a2[u][1] == i:
				print(l[u], end=' ')
f()


(n, w) = map(int, input().split())
a = sorted([(n, i) for (i, n) in enumerate(map(int, input().split()))])
tea = [0] * n
for i in range(n):
	tea[a[i][1]] += (a[i][0] + 1) // 2
w -= sum(tea)
i = n - 1
while w > 0:
	x = min(a[i][0] - tea[a[i][1]], w)
	tea[a[i][1]] += x
	w -= x
	i -= 1
if w < 0:
	print(-1)
else:
	print(*tea)


(n, w) = (int(i) for i in input().split())
arr = [int(i) for i in input().split()]

def function():
	global w
	for (i, size) in enumerate(arr):
		t = round(size / 2 + 0.1)
		dic[size, i] = t
		w -= t
		if w < 0:
			return {1: -1}
	for (size, i) in sorted(dic, reverse=True):
		o = size - dic[size, i]
		dic[size, i] += min(w, o)
		w -= min(o, w)
		if w == 0:
			break
	return dic
dic = {}
print(*function().values())


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
s = 0
for i in range(n):
	s += (a[i] + 1) // 2
	a[i] = [a[i], i]
if s > w:
	print(-1)
else:
	res = [[(a[i][0] + 1) // 2, i] for i in range(n)]
	w -= s
	a.sort(reverse=True)
	i = 0
	while w > 0:
		res[a[i][1]][0] = min(a[i][0], res[a[i][1]][0] + w)
		w -= a[i][0] // 2
		i += 1
	for i in range(n):
		print(res[i][0], end=' ')


import sys
(n, w) = map(int, input().split())
a = sorted(((x, i) for (i, x) in enumerate(map(int, input().split()))), reverse=True)
ans = [0] * n
for (x, i) in a:
	ans[i] = x + 1 >> 1
w -= sum(ans)
if w < 0:
	print('-1')
	exit()
for i in range(n):
	x = min(w, a[i][0] - ans[a[i][1]])
	ans[a[i][1]] += x
	w -= x
print(*ans)


from math import ceil
(n, w) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
indexed = [(a[i], i) for i in range(n)]
indexed.sort()
b = [0] * n
for i in range(n):
	(volume, idx) = indexed[i]
	b[idx] = ceil(volume / 2)
	w -= b[idx]
if w > 0:
	for i in range(n):
		(volume, idx) = indexed[n - i - 1]
		extra = min(w, volume - b[idx])
		b[idx] += extra
		w -= extra
		if w == 0:
			break
print(-1 if w < 0 else ' '.join(map(str, b)))


import math
(n, w) = map(int, input().split())
w2 = w
A = list(map(int, input().split()))
B = [[0 for j in range(3)] for i in range(n)]
count = 0
for i in range(n):
	B[i][0] = i + 1
	B[i][1] = A[i]
	B[i][2] = math.ceil(A[i] / 2)
	count += math.ceil(A[i] / 2)
if count > w:
	print(-1)
else:
	w = w - count
	B = sorted(B, key=lambda B: B[1])
	for i in range(n - 1, -1, -1):
		if w - (B[i][1] - B[i][2]) > 0:
			w = w - (B[i][1] - B[i][2])
			B[i][2] = B[i][1]
		else:
			B[i][2] = B[i][2] + w
			w = 0
	for i in range(n):
		w2 -= B[i][2]
	if w2 > 0:
		print(-1)
		exit(0)
	B = sorted(B, key=lambda B: B[0])
	for i in range(n):
		print(B[i][2], end=' ')


(n, ch) = map(int, input().split(' '))
mas = list(map(int, input().split(' ')))
mas_nach = mas.copy()
for i in range(len(mas)):
	ch -= round(mas[i] / 2 + 1 / 100)
	mas[i] = mas[i] // 2
if ch < 0:
	print(-1)
	exit()

def max_and_nom(massiv):
	nom = 0
	maxx = -1
	for i in range(len(massiv)):
		if massiv[i] >= maxx:
			maxx = massiv[i]
			nom = i
	return [maxx, nom]

def raspred_chai(mas, ch, mas_nach):
	for i in range(len(mas)):
		if mas[max_and_nom(mas_nach)[1]] >= ch:
			mas[max_and_nom(mas_nach)[1]] = mas[max_and_nom(mas_nach)[1]] - ch
			return mas
		else:
			ch -= mas[max_and_nom(mas_nach)[1]]
			mas[max_and_nom(mas_nach)[1]] = 0
			mas_nach[max_and_nom(mas_nach)[1]] = 0
	print(-1)
	exit()
mas1 = raspred_chai(mas, ch, mas_nach.copy())
for i in range(len(mas_nach)):
	mas_nach[i] = mas_nach[i] - mas1[i]
print(*mas_nach)


def luckyYear():
	n = int(input())
	original = n
	p = -1
	f = 0
	while n > 0:
		f = n % 10
		n //= 10
		p += 1
	f += 1
	f *= 10 ** p
	print(f - original)

def averageSleepTime():
	(n, k) = list(map(int, input().split()))
	sleep = list(map(int, input().split()))
	run = 0
	for i in range(k):
		run += sleep[i]
	runavg = [run]
	for i in range(k, n):
		run = run - sleep[i - k] + sleep[i]
		runavg.append(run)
	print('{:.10f}'.format(sum(runavg) / (n - k + 1)))

def teaParty():
	(n, w) = list(map(int, input().split()))
	tea = list(map(int, input().split()))
	fill = []
	[fill.append((t + 1) // 2) for t in tea]
	if sum(tea) < w or sum(fill) > w:
		print(-1)
		return
	w -= sum(fill)
	sortedPos = [i[0] for i in sorted(enumerate(tea), key=lambda x: x[1])]
	for i in sortedPos[::-1]:
		if w <= 0:
			break
		value = min(tea[i] - fill[i], w)
		fill[i] += value
		w -= value
	print(' '.join(map(str, fill)))
teaParty()


(n, w) = [int(inp) for inp in input().split()]
cap = [int(a) for a in input().split(' ')]
val = [0] * n
for i in range(n):
	cap[i] = (cap[i], i)
cap.sort()
cap.reverse()
for i in range(n):
	val[i] = cap[i][0] // 2 + int(cap[i][0] % 2 != 0)
	w -= val[i]
if w < 0:
	print(-1)
	exit()
for i in range(n):
	v = min(w, cap[i][0] - val[i])
	val[i] += v
	w -= v
res = [0] * n
for i in range(n):
	res[cap[i][1]] = val[i]
for r in res:
	print(r, end=' ')


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
b = [0] * n
P = []
for i in range(n):
	P.append((a[i], i))
P = sorted(P, reverse=True)
for i in range(n):
	k = a[i] // 2 + int(a[i] % 2 != 0)
	b[i] += k
	w -= k
if w < 0:
	print(-1)
	exit()
i = 0
while w > 0:
	k = a[P[i][1]] - b[P[i][1]]
	b[P[i][1]] += min(w, k)
	w -= min(w, k)
	i += 1
print(*b)


(n, w) = map(int, input().split())
l = list(map(int, input().split()))
Half = [(i + 1) // 2 for i in l]
pos = [[l[i], (l[i] + 1) // 2, i] for i in range(n)]
pos.sort(reverse=True)
if w < sum(Half):
	print(-1)
	quit()
extra = w - sum(Half)
for i in range(n):
	if extra > 0:
		rem = pos[i][0] - pos[i][1]
		if rem >= extra:
			Half[pos[i][2]] += extra
			extra = 0
			break
		else:
			extra -= rem
			Half[pos[i][2]] = pos[i][0]
print(*Half)


(N, W) = map(int, input().split())
A = list(map(int, input().split()))
ord = sorted([i for i in range(N)], key=lambda x: A[x])
vol = [A[i] + 1 >> 1 for i in range(N)]
W -= sum(vol)
if W < 0:
	print(-1)
	exit(0)
for i in range(N - 1, -1, -1):
	if A[ord[i]] - vol[ord[i]] >= W:
		vol[ord[i]] += W
		break
	else:
		W -= A[ord[i]] - vol[ord[i]]
		vol[ord[i]] = A[ord[i]]
print(*vol)


(n, w) = map(int, input().split())
cup = list(map(int, input().split()))
ncup = []
for (i, c) in enumerate(cup):
	ncup.append([c, i])
ncup.sort()
tea = []
for (c, i) in ncup:
	t = c // 2 if c % 2 == 0 else c // 2 + 1
	w -= t
	tea.append([t, i])
for i in range(len(ncup) - 1, -1, -1):
	if w < 0:
		break
	add = min(w, ncup[i][0] - tea[i][0])
	w -= add
	tea[i][0] += add
if w != 0:
	print(-1)
else:
	tea.sort(key=lambda a: a[1])
	for (t, i) in tea:
		print(t, end=' ')
print()


(n, w) = map(int, input().split())
A = [(int(x), i) for (i, x) in enumerate(input().split())]
A.sort()
A.reverse()
B = [(x[0] + 1) // 2 for x in A]
left = w - sum(B)
if left < 0:
	print(-1)
else:
	for i in range(len(B)):
		to_add = min([left, A[i][0] - B[i]])
		B[i] += to_add
		left -= to_add
	assert left == 0
	result = [-1] * n
	for i in range(len(B)):
		result[A[i][1]] = B[i]
	print(' '.join(map(str, result)))


from math import *
(n, w) = map(int, input().split())
mas = list(map(int, input().split()))
mas2 = []
su = 0
for i in range(n):
	su += ceil(mas[i] / 2)
	mas2.append([ceil(mas[i] / 2), mas[i], i])
if su > w:
	print(-1)
	exit()
else:
	mas2.sort()
	ost = w - su
	x = len(mas2) - 1
	while ost > 0:
		while ost > 0 and mas2[x][0] < mas2[x][1]:
			ost -= 1
			mas2[x][0] += 1
		x -= 1
ans = [0] * n
for i in range(n):
	ans[mas2[i][2]] = mas2[i][0]
print(*ans)


(n, w) = map(int, input().split())
a = list(map(int, input().split()))
pair = list()
cnt = 0
for i in range(n):
	cnt += int(a[i] / 2)
	if a[i] % 2:
		cnt += 1
if cnt > w:
	print(-1)
else:
	for i in range(n):
		pair.append((a[i], i))
	for i in range(n):
		x = int(a[i] / 2)
		if a[i] % 2:
			x += 1
		a[i] = x
		w -= a[i]
	pair.sort()
	pair.reverse()
	for i in range(n):
		x = pair[i][0]
		y = pair[i][1]
		p = x - a[y]
		if w >= p:
			a[y] += p
			w -= p
		else:
			a[y] += w
			w = 0
		if w == 0:
			break
	for i in range(n):
		print(a[i], end=' ')


(_, tea) = [int(x) for x in input().split(' ')]
sizes = [int(x) for x in input().split(' ')]
currsize = [0] * len(sizes)
nums = [i for i in range(len(sizes))]
nums = [x for (_, x) in sorted(zip(sizes, nums))]
sizes.sort()
for i in range(len(sizes)):
	tea -= (sizes[i] + 1) // 2
	currsize[i] = (sizes[i] + 1) // 2
if tea < 0:
	print(-1)
else:
	index = len(sizes) - 1
	while tea > 0 and index >= 0:
		if tea > sizes[index] - currsize[index]:
			tea -= sizes[index] - currsize[index]
			currsize[index] = sizes[index]
			index -= 1
		else:
			currsize[index] += tea
			tea = 0
	if tea != 0:
		print(-1)
	else:
		currsize = [x for (_, x) in sorted(zip(nums, currsize))]
		out = ''
		for i in currsize:
			out += str(i) + ' '
		print(out[:-1])


import math
import heapq
(n, w) = map(int, input().split())
a = list(map(int, input().split()))
aans = [0] * len(a)
heapa = []
for (i, x) in enumerate(a):
	half = math.ceil(x / 2)
	w -= half
	aans[i] = half
	heapq.heappush(heapa, (x, x - half, i))
if w < 0:
	print('-1')
else:
	for i in reversed(sorted(heapa)):
		extra = min(w, i[1])
		w -= extra
		aans[i[2]] += extra
		if w == 0:
			break
	print(' '.join((str(x) for x in aans)))


(n, w) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [(x + 1) // 2 for x in a]
w -= sum(b)
if w > 0:
	a = [(a[i], i) for i in range(n)]
	a.sort(reverse=True)
	for i in range(n):
		x = min(a[i][0] - b[a[i][1]], w)
		w -= x
		b[a[i][1]] += x
		if w == 0:
			break
if w >= 0:
	print(*b)
else:
	print(-1)


class Node:

	def __init__(self, value, id):
		self.value = value
		self.id = id
		self.ans = 0

def solve():
	(sum1, sum2) = (0, 0)
	for x in p:
		tmp = int((x.value + 1) / 2)
		sum1 += tmp
		sum2 += x.value
		x.ans += tmp
	if sum1 > w or sum2 < w:
		return -1
	sum = w - sum1
	for i in range(n - 1, -1, -1):
		if sum == 0:
			break
		tmp = p[i].value - p[i].ans
		if sum >= tmp:
			p[i].ans += tmp
			sum -= tmp
		else:
			p[i].ans += sum
			sum = 0
	p.sort(key=lambda x: x.id)
	return 0
while True:
	try:
		(n, w) = map(int, input().split(' '))
	except:
		break
	p = [Node(int(x), i + 1) for (i, x) in enumerate(input().split(' '))]
	p.sort(key=lambda x: x.value)
	if solve() == -1:
		print('-1')
	else:
		for i in range(n):
			if i:
				print(' ', end='')
			print(p[i].ans, end='')
		print()


from sys import exit
(n, w) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
for i in range(n):
	a[i] = (a[i], i)
a.sort(reverse=True)
ch = [0] * n
for i in range(n):
	ch[a[i][1]] = (a[i][0] + 1) // 2
	w -= ch[a[i][1]]
	if w < 0:
		print(-1)
		exit(0)
for i in range(n):
	if w > 0:
		add = min(w, a[i][0] - ch[a[i][1]])
		ch[a[i][1]] += add
		w -= add
print(*ch)


(n, w) = map(int, input().split())
a = [(int(x), i) for (i, x) in enumerate(input().split())]
a.sort()
b = [0] * n
for i in range(len(a)):
	(x, pos) = a[i]
	b[pos] = (x + 1) // 2
	w -= b[pos]
if w < 0:
	print(-1)
else:
	for i in reversed(range(len(a))):
		(x, pos) = a[i]
		k = min(x - b[pos], w)
		w -= k
		b[pos] += k
	print(' '.join(map(str, b)))


import sys
import math

def IO():
	sys.stdin = open('pyinput.txt', 'r')
	sys.stdout = open('pyoutput.txt', 'w')

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

def LCM(a, b):
	return a * (b // GCD(a, b))

def scan(TYPE_1, TYPE_2=0):
	if TYPE_1 == int:
		return map(int, sys.stdin.readline().strip().split())
	elif TYPE_1 == float:
		return map(float, sys.stdin.readline().strip().split())
	elif TYPE_1 == list and TYPE_2 == float:
		return list(map(float, sys.stdin.readline().strip().split()))
	elif TYPE_1 == list and TYPE_2 == int:
		return list(map(int, sys.stdin.readline().strip().split()))
	elif TYPE_1 == str:
		return sys.stdin.readline().strip()
	else:
		print('ERROR!!!!')

def main():
	(n, k) = scan(int)
	a = scan(list, int)
	idx = []
	for i in range(n):
		idx.append((a[i], i))
	idx.sort()
	ans = [(i + 1) // 2 for i in a]
	x = sum(ans)
	if x > k:
		print(-1)
		return
	k -= x
	i = n - 1
	while k > 0:
		x = idx[i][1]
		inc = min(a[x] - ans[x], k)
		ans[x] += inc
		k -= inc
		i -= 1
	print(*ans)
main()


import sys
input = sys.stdin.buffer.readline

def solution():
	(n, w) = map(int, input().split())
	l = list(map(int, input().split()))
	a = []
	z = [0] * n
	ans = 0
	for i in range(n):
		if l[i] % 2 == 0:
			ans += l[i] // 2
			a.append([l[i], l[i] // 2, i])
		else:
			ans += l[i] // 2 + 1
			a.append([l[i], l[i] // 2 + 1, i])
	if ans > w:
		print(-1)
		exit(0)
	x = w - ans
	a.sort(reverse=True)
	i = 0
	while x > 0 and i < n:
		d = a[i][0] - a[i][1]
		if x <= d:
			a[i][1] += x
			x = 0
		else:
			a[i][1] = a[i][0]
			x -= d
		i += 1
	a.sort(key=lambda x: x[2])
	for i in range(n):
		print(a[i][1], end=' ')
solution()


import sys, math, queue
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
(n, w) = map(int, input().split())
b = list(map(int, input().split()))
a = sorted([(b[i], i) for i in range(n)], reverse=True)
ans = [-1 for i in range(n)]
for i in range(n):
	ans[a[i][1]] = (a[i][0] + 1) // 2
	w -= ans[a[i][1]]
for i in range(n):
	if w > 0:
		d = b[a[i][1]] - ans[a[i][1]]
		ans[a[i][1]] += min(w, d)
		w -= min(w, d)
	else:
		break
if w < 0:
	print(-1)
else:
	print(*ans)


from sys import stdin, stdout
from math import ceil
(n, w) = map(int, stdin.readline().split())
values = list(map(int, stdin.readline().split()))
fill = [0 for i in range(n)]
for i in range(n):
	values[i] = (values[i], i)
values.sort()
label = 1
for i in range(n - 1, -1, -1):
	if ceil(values[i][0] / 2) <= w:
		fill[i] = ceil(values[i][0] / 2)
		w -= ceil(values[i][0] / 2)
	else:
		label = 0
if not label:
	stdout.write(str('-1'))
else:
	for i in range(n - 1, -1, -1):
		cnt = min(w, values[i][0] - fill[i])
		fill[i] += min(w, values[i][0] - fill[i])
		w -= cnt
	ans = [0 for i in range(n)]
	if w:
		stdout.write('-1')
	else:
		for i in range(n):
			ans[values[i][1]] = fill[i]
		stdout.write(' '.join(list(map(str, ans))))


import math
(n, w) = map(int, input().split())
a = list(map(int, input().split()))
l = []
for i in range(n):
	l.append([a[i], i, math.ceil(a[i] / 2)])
l.sort(reverse=True)
s = 0
for i in range(n):
	s += l[i][2]
if w < s:
	print(-1)
else:
	rest = w - s
	for i in range(n):
		if rest != 0:
			t = l[i][2]
			l[i][2] = min(l[i][0], l[i][2] + rest)
			rest = rest - (l[i][2] - t)
		else:
			break
	ans = [0] * n
	for i in range(n):
		ans[l[i][1]] = l[i][2]
	print(*ans)


import sys
import os
import math
(n, w) = map(int, input().split())
A = list(map(int, input().split()))
pours = [None] * n
B = []
for (i, a) in enumerate(A):
	B.append((a, i))
B.sort()
for b in B:
	cup = b[0]
	i = b[1]
	pour_amount = math.ceil(cup / 2)
	pours[i] = pour_amount
	w -= pour_amount
if w < 0:
	print(-1)
else:
	for i in range(n - 1, -1, -1):
		(cup, idx) = B[i]
		if cup > pours[idx]:
			re_pour_amount = min(w, cup - pours[idx])
			pours[idx] += re_pour_amount
			w -= re_pour_amount
	print(*pours)


from sys import stdout
(n, w) = map(int, input().split())
a = [int(i) for i in input().split()]
a = sorted([(a[i], i) for i in range(n)])
b = [0] * n
for i in a:
	b[i[1]] += i[0] // 2 + (1 if i[0] % 2 else 0)
	w -= b[i[1]]
	if w < 0:
		print(-1)
		exit()
for i in range(-1, -n - 1, -1):
	if w <= 0:
		break
	k = min(w, a[i][0] - b[a[i][1]])
	b[a[i][1]] += k
	w -= k
stdout.write(str(b[0]))
for i in b[1:]:
	stdout.write(' ' + str(i))


import math
(n, w) = list(map(int, input().split()))
a = list(map(int, input().split()))
store = {}
sum_min = 0
ans = []
flag = False
for (i, item) in enumerate(a):
	sum_min += math.ceil(item / 2)
	if sum_min > w:
		print('-1')
		flag = True
		break
	ans.append(math.ceil(item / 2))
	store[i] = item
if not flag:
	store = sorted(store.items(), key=lambda kv: (kv[1], kv[0]), reverse=True)
	for item in store:
		if sum_min < w:
			d = min(a[item[0]] - ans[item[0]], w - sum_min)
			ans[item[0]] += d
			sum_min += d
		else:
			break
	if sum_min < w:
		print('-1')
	else:
		print(*ans)