Little Vova studies programming in an elite school. Vova and his classmates are supposed to write n progress tests, for each test they will get a mark from 1 to p. Vova is very smart and he can write every test for any mark, but he doesn't want to stand out from the crowd too much. If the sum of his marks for all tests exceeds value x, then his classmates notice how smart he is and start distracting him asking to let them copy his homework. And if the median of his marks will be lower than y points (the definition of a median is given in the notes), then his mom will decide that he gets too many bad marks and forbid him to play computer games.

Vova has already wrote k tests and got marks a_1, ..., a_{k}. He doesn't want to get into the first or the second situation described above and now he needs to determine which marks he needs to get for the remaining tests. Help him do that.


-----Input-----

The first line contains 5 space-separated integers: n, k, p, x and y (1 ≤ n ≤ 999, n is odd, 0 ≤ k < n, 1 ≤ p ≤ 1000, n ≤ x ≤ n·p, 1 ≤ y ≤ p). Here n is the number of tests that Vova is planned to write, k is the number of tests he has already written, p is the maximum possible mark for a test, x is the maximum total number of points so that the classmates don't yet disturb Vova, y is the minimum median point so that mom still lets him play computer games.

The second line contains k space-separated integers: a_1, ..., a_{k} (1 ≤ a_{i} ≤ p) — the marks that Vova got for the tests he has already written.


-----Output-----

If Vova cannot achieve the desired result, print "-1".

Otherwise, print n - k space-separated integers — the marks that Vova should get for the remaining tests. If there are multiple possible solutions, print any of them.


-----Examples-----
Input
5 3 5 18 4
3 5 4

Output
4 1

Input
5 3 5 16 4
5 5 5

Output
-1



-----Note-----

The median of sequence a_1, ..., a_{n} where n is odd (in this problem n is always odd) is the element staying on (n + 1) / 2 position in the sorted list of a_{i}.

In the first sample the sum of marks equals 3 + 5 + 4 + 4 + 1 = 17, what doesn't exceed 18, that means that Vova won't be disturbed by his classmates. And the median point of the sequence {1, 3, 4, 4, 5} equals to 4, that isn't less than 4, so his mom lets him play computer games.

Please note that you do not have to maximize the sum of marks or the median mark. Any of the answers: "4 2", "2 4", "5 1", "1 5", "4 1", "1 4" for the first test is correct.

In the second sample Vova got three '5' marks, so even if he gets two '1' marks, the sum of marks will be 17, that is more than the required value of 16. So, the answer to this test is "-1".

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Implementation

Greedy algorithms


Solutions:
from sys import stdin, stdout

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

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

def ip():
	return int(stdin.readline())

def op(ans):
	return stdout.write(str(ans) + '\n')
from statistics import median
(n, k, p, x, y) = ei()
li = ai()
lt = 0
for i in range(k):
	if li[i] < y:
		lt += 1
ans = [1] * min(n - k, n // 2 - lt)
while len(ans) < n - k:
	ans.append(y)
if sum(ans + li) <= x and median(ans + li) >= y:
	print(*ans)
else:
	print(-1)


(n, k, p, x, y) = map(int, input().split())
arr = list(map(int, input().split()))
count = 0
total = 0
for i in arr:
	if i >= y:
		count += 1
	total += i
least = n - (n + 1) // 2 + 1
ok = True
ans = [0] * (n - k)
if count >= least:
	total += 1 * (n - k)
	for i in range(n - k):
		ans[i] = 1
elif least - count <= n - k:
	k1 = least - count
	total += k1 * y + (n - k - k1) * 1
	for i in range(k1):
		ans[i] = y
	for i in range(k1, n - k):
		ans[i] = 1
else:
	ok = False
if ok:
	if total > x:
		ok = False
if not ok:
	print(-1)
else:
	for i in ans:
		print(i, end=' ')


(n, k, p, x, y) = map(int, input().split())
a = list(map(int, input().split()))
t = 0
for i in a:
	if i < y:
		t += 1
m = (n + 1) // 2
if t >= m:
	print(-1)
else:
	ans = []
	ans += [y] * max(0, m - (k - t))
	k += max(0, m - (k - t))
	ans += [1] * max(0, n - k)
	if sum(ans) + sum(a) <= x:
		for i in ans[:-1]:
			print(i, end=' ')
		print(ans[-1])
	else:
		print(-1)


import sys
from bisect import bisect, bisect_left
(n, k, p, x, y) = [int(x) for x in input().split()]
grades = [int(x) for x in input().split()]
grades = sorted(grades)
total = sum(grades)
if total + n - k > x:
	print(-1)
	sys.exit(0)
mid = int((n + 1) / 2)
less = bisect_left(grades, y)
grea = k - less
if less >= mid:
	print(-1)
	sys.exit(0)
if grea > mid:
	less += grea - mid
	grea = mid
output = mid - 1 - less + (mid - grea) * y
if output + total > x:
	print(-1)
	sys.exit(0)
print(' '.join(['1'] * (mid - 1 - less) + [str(y)] * (mid - grea)))


(n, k, p, x, y) = [int(k) for k in input().split()]
scores = [int(k) for k in input().split()]
s = sum(scores)
number_needed = (n - 1) / 2
B = x - s
done = False
while not done:
	num_above = 0
	num_below = 0
	for i in scores:
		if i >= y:
			num_above += 1
		else:
			num_below += 1
	num_needed_above = int(number_needed + 1 - num_above)
	num_needed_below = int(number_needed - num_below)
	if num_needed_below < 0:
		print(-1)
		break
	if num_needed_above < 0:
		num_needed_above = 0
		num_needed_below = n - k
	rem_sum = y * num_needed_above + 1 * num_needed_below
	if rem_sum <= B:
		for i in range(num_needed_below):
			print(1, end=' ')
		for i in range(num_needed_above):
			print(y, end=' ')
		done = True
	else:
		y = y + 1
		if y > p:
			print(-1)
			break


def main():
	(n, k, p, x, y) = list(map(int, input().split()))
	L = list(map(int, input().split()))
	[L.append(y) for _ in range(n - k)]
	cnt = 0
	for i in range(n):
		if L[i] >= y:
			cnt += 1
	m = (n + 1) / 2
	for i in range(k, n):
		if cnt > m:
			L[i] = 1
			cnt -= 1
	if sum(L) > x or cnt < m:
		print(-1)
	else:
		print(' '.join(map(str, L[k:])))

def __starting_point():
	main()
__starting_point()


(n, k, p, x, y) = map(int, input().split())
A = list(map(int, input().split()))
cnt = n // 2 + 1
for i in A:
	if i >= y:
		cnt -= 1
cnt = max(cnt, 0)
if n - k < cnt:
	print(-1)
else:
	B = [y] * cnt + [1] * (n - k - cnt)
	if sum(A) + sum(B) > x:
		print(-1)
	else:
		for i in B:
			print(i, end=' ')


(n, k, p, x, y) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
marks = []
if n > 1:
	while len(a) < n and (len(a) <= (n + 1) // 2 - 2 or (n + 1) // 2 - 2 < 0 or a[(n + 1) // 2 - 2] >= y):
		a = [1] + a
		marks.append(1)
else:
	marks = [y]
	a = [y]
marks += [y] * (n - len(a))
a += [y] * (n - len(a))
a.sort()
if sum(a) > x or a[(n + 1) // 2 - 1] < y:
	print(-1)
else:
	print(' '.join(map(str, marks)))


from statistics import median
(N, K, P, X, Y) = list(map(int, input().split()))
A = list(map(int, input().split()))
lt = 0
for i in range(K):
	if A[i] < Y:
		lt += 1
ans = [1] * min(N // 2 - lt, N - K)
while len(ans) < N - K:
	ans.append(Y)
if sum(ans + A) <= X and median(ans + A) >= Y:
	print(' '.join(map(str, ans)))
else:
	print('-1')


(n, k, p, x, y) = [int(i) for i in input().split()]
left = 0
right = 0
for a in input().split():
	a = int(a)
	x -= a
	if a < y:
		left += 1
	elif a >= y:
		right += 1
if left > n // 2:
	print(-1)
	exit()
elif right > n // 2:
	ans = [1] * (n - k)
else:
	ans = [1] * (n // 2 - left) + [y] * ((n + 1) // 2 - right)
if sum(ans) > x:
	print(-1)
else:
	print(' '.join([str(i) for i in ans]))


(n, k, p, x, y) = map(int, input().split())
a = list(map(int, input().split()))
r = 0
for i in a:
	if i >= y:
		r += 1
r = max(n // 2 + 1 - r, 0)
suma = sum((v for v in a))
if suma + r * y + (n - r - k) > x or k + r > n:
	print(-1)
else:
	for i in range(r):
		print(y, end=' ')
	for i in range(n - r - k):
		print(1, end=' ')
	print()


3.4
v = input().split()
(n, k, p, x, y) = (int(v[0]), int(v[1]), int(v[2]), int(v[3]), int(v[4]))
if p < y:
	print('-1')
	return
b = list(map(int, input().split()))
b.sort()
cur = sum(b)
if cur + n - k > x:
	print(-1)
	return
median = (n + 1) // 2
lower_bound = len(b) - 1
while lower_bound >= 0 and b[lower_bound] >= y:
	lower_bound -= 1
lower_bound += 2
max_count_of_ones = median - lower_bound
if max_count_of_ones < 0:
	print(-1)
	return
if max_count_of_ones + y * (n - k - max_count_of_ones) + cur > x:
	print(-1)
	return
for i in range(min(n - k, max_count_of_ones)):
	print('1', end=' ')
for i in range(min(abs(n - k - max_count_of_ones), n - k - max_count_of_ones)):
	print(y, end=' ')


(n, k, p, x, y) = map(int, input().split())
s = 0
cnt = 0
sz = 0
ans = []
for arr in map(int, input().split()):
	s += arr
	sz += 1
	if arr >= y:
		cnt += 1
while cnt < (n + 1) / 2:
	ans.append(y)
	cnt += 1
while len(ans) + k < n:
	ans.append(1)
if s + sum(ans) <= x and len(ans) + sz == n:
	for i in range(len(ans)):
		print(ans[i], '', end='')
	print('')
else:
	print('-1')


(n, k, p, x, y) = map(int, input().split())
if k > 0:
	scores = list(map(int, input().split()))
	scores.sort()
else:
	scores = []
idex = n // 2
ans = []
while k < n:
	if k <= idex - 2:
		scores = [1] + scores
		ans.append(1)
		k += 1
	elif k == idex - 1:
		if not scores:
			scores = [1]
			ans.append(1)
		elif scores[-1] >= y:
			scores = [1] + scores
			ans.append(1)
		else:
			scores.append(y)
			ans.append(y)
		k += 1
	else:
		if not scores:
			scores = [y]
			ans.append(y)
		elif scores[idex - 1] >= y:
			scores = [1] + scores
			ans.append(1)
		else:
			scores.append(y)
			ans.append(y)
		k += 1
if sum(scores) <= x and scores[idex] >= y:
	print(*ans)
else:
	print(-1)


(n, k, p, x, y) = [int(token) for token in input().split()]
l = [int(token) for token in input().split()]
k_lower = sum((1 for a in l if a < y))
k_upper = k - k_lower
ik_lower = int((n - 1) / 2) - k_lower
ik_upper = int((n + 1) / 2) - k_upper
if ik_lower < 0:
	print('-1')
elif ik_upper < 0:
	if ik_lower + ik_upper + sum(l) > x:
		print('-1')
	else:
		l = [1] * (ik_lower + ik_upper)
		l_string = (str(a) for a in l)
		print(' '.join(l_string))
elif ik_lower + y * ik_upper + sum(l) > x:
	print('-1')
else:
	il_lower = [1] * ik_lower
	il_upper = [y] * ik_upper
	l = il_lower + il_upper
	l_string = (str(a) for a in l)
	print(' '.join(l_string))


(n, k, p, x, y) = map(int, input().split())
(s, g, l) = (0, 0, [])
for a in map(int, input().split()):
	s += a
	g += a >= y
for i in range(n - k):
	c = 1 if g >= n // 2 + 1 else y
	s += c
	g += c == y
	l.append(c)
print(' '.join(map(str, l)) if s <= x and g >= n // 2 + 1 else -1)


(n, k, p, x, y) = map(int, input().split())
l = [int(xx) for xx in input().split()]
l.sort()
s = sum(l)
cnt = 0
check = -1
ans = []
for val in l:
	if val < y:
		cnt += 1
if s + (n - k) > x or 2 * cnt > n:
	print(-1)
	exit(0)
left = min(n // 2 - cnt, n - k)
right = n - k - left
rightscore = right * y
if s + left + rightscore > x:
	print(-1)
else:
	for i in range(left):
		ans.append(1)
	for i in range(right):
		ans.append(y)
	print(*ans)


(n, k, p, x, y) = map(int, input().split(' '))
li = list(map(int, input().split(' ', k)[:k]))
li.sort()
(cn, cn1) = (0, 0)
for i in range(k):
	if li[i] < y:
		cn1 += 1
	else:
		cn += 1
if cn1 > (n - 1) // 2:
	print(-1)
elif cn >= (n + 1) // 2:
	if sum(li) + n - k > x:
		print(-1)
	else:
		for i in range(n - k):
			print(1, end=' ')
		print()
else:
	li2 = [y] * ((n + 1) // 2 - cn)
	if sum(li2) + sum(li) + n - k - len(li2) > x:
		print(-1)
	else:
		li2 = [str(i) for i in li2]
		print(' '.join(li2), end=' ')
		for i in range(n - k - len(li2)):
			print(1, end=' ')
		print()


(n, k, p, x, y) = list(map(int, input().split()))
marks = list(map(int, input().split()))
marks.sort()
less = 0
more = 0
equal = 0
midway = (n + 1) // 2
final = []
for i in marks:
	if i < y:
		less += 1
	elif i == y:
		equal += 1
	else:
		more += 1
if less >= midway:
	print(-1)
elif more + equal >= midway:
	final.extend((n - k) * [1])
	if sum(final) + sum(marks) <= x:
		for i in range(len(final)):
			print(final[i], end=' ')
	else:
		print(-1)
else:
	final.extend((midway - 1 - less) * [1])
	final.extend((midway - (more + equal)) * [y])
	if sum(final) + sum(marks) <= x:
		for i in range(len(final)):
			print(final[i], end=' ')
	else:
		print(-1)


(n, k, p, x, y) = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
if n == 1:
	if y > x:
		print(-1)
	else:
		print(y)
	exit(0)
a.sort()
med_pos = n // 2
s = sum(a)
if len(a) > med_pos and a[med_pos] < y:
	print(-1)
	exit(0)
if s + (n - k) > x:
	print(-1)
	exit(0)
ind = -1
for i in range(len(a)):
	if a[i] >= y:
		ind = i
		break
if ind == -1:
	ind = len(a)
left = min(n - k, med_pos - ind)
right = max(0, n - k - left)
if s + left + y * right > x:
	print(-1)
	exit(0)
for i in range(left):
	print(1, end=' ')
for i in range(right):
	print(y, end=' ')


from bisect import insort
(tot, wr, ma, mas, mis) = map(int, input().split())
s = sorted(map(int, input().split()))
res = []
while wr < tot:
	if not s or (s[wr // 2] < mis or s[wr // 2 - 1] < mis):
		res.append(mis)
		insort(s, mis)
	else:
		res.append(1)
		insort(s, 1)
	wr += 1
if sum(s) <= mas and s[tot // 2] >= mis:
	print(' '.join(map(str, res)))
else:
	print(-1)


(n, k, p, x, y) = map(int, input().split())
V = list(map(int, input().split()))
suma = sum(V)
smaller = 0
for num in V:
	if num < y:
		smaller += 1
if smaller >= (n + 1) / 2:
	print('-1')
else:
	no1 = (n + 1) / 2 - smaller - 1
	no1 = int(no1)
	noy = n - k - no1
	if no1 < 0:
		noy += no1
		no1 = 0
	elif noy < 0:
		no1 += noy
		noy = 0
	if suma + no1 + y * noy > x:
		print('-1')
	else:
		print('1 ' * no1 + '{} '.format(y) * noy)


def print_lst(lst):
	print(' '.join(map(str, lst)))
(n, k, p, x, y) = list(map(int, input().split()))
pi = list(map(int, input().split()))
spi = sum(pi)
res = []
c_lm = 0
c_hm = 0
for el in pi:
	if el < y:
		c_lm += 1
	else:
		c_hm += 1
n_hm = n // 2 + 1 - c_hm
n_lm = n // 2 - c_lm
for i in range(n - k):
	if n_hm > 0:
		res += [y]
		pi += [y]
		n_hm -= 1
	elif n_lm > 0:
		res += [1]
		pi += [1]
		n_lm -= 1
pis = sorted(pi)
if sum(pis) > x:
	print(-1)
elif pis[len(pis) // 2] < y:
	print(-1)
else:
	print_lst(res)


(n, k, p, x, y) = map(int, input().split())
s = list(map(int, input().split()))
m = (n + 2 - 1) // 2
count = 0
for i in range(len(s)):
	if s[i] < y:
		count += 1
ans = []
if n - k > m - count - 1:
	ans += (m - count - 1) * [1]
	if 0 < n - len(ans) - len(s):
		ans += (n - len(ans) - len(s)) * [y]
else:
	ans += (n - k) * [1]
	if 0 < n - len(ans) - len(s):
		ans += (n - len(ans) - len(s)) * [y]
p = sorted(s + ans)
if sum(s) + sum(ans) > x or p[m - 1] < y:
	print(-1)
else:
	print(*ans)


(n, k, p, x, y) = map(int, input().split())
a = sorted(list(map(int, input().split())))
s = sum(a)
if x - s < n - k:
	print(-1)
	exit()
inf = 10000000
ind = inf
for i in range(k):
	if a[i] >= y:
		ind = i
		break
if k == 0:
	ind = 0
if ind == inf:
	ind = k
need = x - s
k = n - k
ans = []
while ind < n // 2 and k > 0:
	ans.append(1)
	k -= 1
	ind += 1
	need -= 1
if k == 0:
	print(' '.join(map(str, ans)))
	exit()
while k > 0:
	tmp = need / k
	tmp = min(int(tmp + 0.5), p)
	ans.append(tmp)
	need -= tmp
	k -= 1
a.extend(ans)
a.sort()
if a[n // 2] < y:
	print(-1)
else:
	print(' '.join(map(str, ans)))


s = input().split(' ')
n = int(s[0])
k = int(s[1])
p = int(s[2])
x = int(s[3])
y = int(s[4])
newmarks = []
curmin = 0
sum = 0
med = (n + 1) / 2
if k > 0:
	s = input().split(' ')
	for i in s:
		mark = int(i)
		if mark < y:
			curmin += 1
		sum += mark
for i in range(n - k):
	if curmin + 1 < med:
		newmarks.append(1)
		curmin += 1
		sum += 1
	else:
		newmarks.append(y)
		sum += y
if sum > x:
	print(-1)
	exit(0)
if curmin >= med:
	print(-1)
	exit(0)
else:
	print(' '.join([str(x) for x in newmarks]))


(n, k, p, x, y) = map(int, input().split())
s = list(map(int, input().split()))
s = sorted(s)
if p < y:
	print(-1)
else:
	kol = 0
	summ = 0
	for i in s:
		summ += i
		if i >= y:
			kol += 1
	if k - kol >= n // 2 + 1 or summ > x:
		print(-1)
	elif kol >= n // 2 + 1:
		if summ + n - k <= x:
			print('1 ' * (n - k))
		else:
			print(-1)
	elif summ + y * (n // 2 + 1 - kol) + (n - k - n // 2 - 1 + kol) > x:
		print(-1)
	else:
		for i in range(n // 2 + 1 - kol):
			print(y, end=' ')
		for i in range(n - k - n // 2 - 1 + kol):
			print('1', end=' ')


from sys import stdin

def main():
	(n, k, p, x, y) = map(int, stdin.readline().split())
	ar = list(map(int, stdin.readline().split()))
	count = 0
	total = 0
	for elm in ar:
		if elm >= y:
			count += 1
		total += elm
	least = n - (n + 1) // 2 + 1
	ok = True
	ans = [0] * (n - k)
	if count >= least:
		total += 1 * (n - k)
		for i in range(n - k):
			ans[i] = 1
	elif least - count <= n - k:
		k1 = least - count
		total += k1 * y + (n - k - k1) * 1
		for i in range(k1):
			ans[i] = y
		for i in range(k1, n - k):
			ans[i] = 1
	else:
		ok = False
	if ok:
		if total > x:
			ok = False
	if not ok:
		print(-1)
	else:
		print(*ans)
main()


def main():
	(n, k, p, x, y) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	median = int((n + 1) / 2)
	less = 0
	for i in range(len(a)):
		if a[i] < y:
			less += 1
	if less >= median:
		print(-1)
		return
	fillOne = min(median - less - 1, n - k)
	if sum(a) + fillOne * 1 + (n - k - fillOne) * y > x:
		print(-1)
		return
	for i in range(fillOne):
		print(1, end=' ')
	for i in range(n - k - fillOne):
		print(y, end=' ')
main()


(n, k, p, x, y) = map(int, input().split())
written = sorted([int(x) for x in input().split()])
if sum(written) + (n - k) > x:
	print(-1)
	return
answer = []
for i in range(n - k):
	median_index = len(written) // 2
	if len(written) % 2 == 0:
		try:
			test = written[median_index - 1]
		except IndexError:
			test = 0
		if test < y:
			written.append(y)
			answer.append(y)
		else:
			written.append(1)
			answer.append(1)
	elif written[median_index] < y:
		written.append(y)
		answer.append(y)
	else:
		written.append(1)
		answer.append(1)
	written.sort()
median_index = len(written) // 2
if sum(written) > x or written[median_index] < y:
	print(-1)
	return
print(' '.join((str(x) for x in answer)))


import bisect
(n, k, p, x, y) = [int(x) for x in input().split()]
marks = [int(x) for x in input().split()]
marks.sort()
if k >= (n + 1) // 2 and marks[(n + 1) // 2 - 1] < y:
	print(-1)
else:
	r = bisect.bisect_left(marks, y)
	marks.extend([1 for i in range(min((n + 1) // 2 - r - 1, n - k))])
	marks.extend([y for i in range(n - len(marks))])
	if sum(marks) > x:
		print(-1)
	else:
		for i in marks[k:]:
			print(i, end=' ')


(n, k, p, x, y) = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
a_l = 0
a_g = 0
for i in a:
	if i < y:
		a_l += 1
	else:
		a_g += 1
if a_l > (n - 1) / 2:
	print(-1)
elif a_g > (n - 1) / 2:
	sum_a = sum(a) + n - k
	if sum_a <= x:
		for i in range(n - k):
			print(1, end=' ')
		print()
	else:
		print(-1)
else:
	sum_a = sum(a) + int((n + 1) / 2 - a_g) * y + (n - 1) / 2 - a_l
	if sum_a <= x:
		for i in range(int((n - 1) / 2) - a_l):
			print(1, end=' ')
		for i in range(int((n + 1) / 2) - a_g):
			print(y, end=' ')
		print()
	else:
		print(-1)


from sys import stdin, stdout
from collections import Counter
nmbr = lambda : int(input())
lst = lambda : list(map(int, input().split()))
for _ in range(1):
	(n, k, pp, x, y) = lst()
	a = lst()
	d = Counter(a)
	added = n - k
	a += [y] * (n - k)
	a.sort()
	sm = sum(a)
	p = n - 1
	f = 1
	while p >= 0 and sm > x and (added > 0):
		if a[p] == y:
			sm -= a[p] - 1
			a[p] = 1
			added -= 1
		p -= 1
	for v11 in a:
		if 1 <= v11 <= pp:
			continue
		f = 0
		break
	a.sort()
	if a[n // 2] < y or sum(a) > x:
		f = 0
	if f == 0:
		print(-1)
		continue
	d1 = Counter(a)
	mp = {}
	ans = []
	for (k, v) in d.items():
		mp[k] = mp.get(k, 0) + v
	for (k, v) in d1.items():
		mp[k] = mp.get(k, 0) - v
	for (k, v) in mp.items():
		if v != 0:
			ans += [k] * abs(v)
	print(*ans)


import sys
(n, k, p, x, y) = map(int, input().split())
a = list(map(int, input().split()))
cnt = (n + 1) // 2 - 1
sm = sum(a)
rest = n - k
for i in range(0, len(a)):
	if a[i] < y:
		cnt -= 1
if sm + rest > x:
	print(-1)
	sys.exit()
if cnt < 0:
	print(-1)
	sys.exit()
if sm + cnt + (rest - cnt) * y > x:
	print(-1)
	sys.exit()
a = [y] * (rest - cnt) + [1] * cnt
for i in range(0, rest):
	print(a[i], end=' ')


(n, k, p, x, y) = map(int, input().split())
a = list(map(int, input().split()))
m = (n + 1) // 2
a.sort()
ans = []
c = 0
for i in range(k):
	if a[i] < y:
		c += 1
	else:
		break
ans += min(n - k, m - c - 1) * [1]
ans += max(0, n - len(ans) - k) * [y]
z = ans + a
z.sort()
if z[m - 1] < y or sum(z) > x:
	print(-1)
	exit()
print(' '.join(map(str, ans)))


(n, k, p, x, y) = map(int, input().split())
arrA = list(map(int, input().split()))
cnt = n // 2 + 1
for i in arrA:
	if i >= y:
		cnt -= 1
cnt = max(cnt, 0)
if n - k < cnt:
	print(-1)
	exit()
arrB = [y] * cnt + [1] * (n - k - cnt)
if sum(arrA) + sum(arrB) > x:
	print(-1)
	exit()
for i in arrB:
	print(i, end=' ')


(n, k, p, x, y) = map(int, input().split())
a = list(map(int, input().split()))
(l, u) = ([], [])
for v in a:
	if v < y:
		l.append(v)
	else:
		u.append(v)
if len(l) > n // 2:
	print(-1)
	exit(0)
ans = []
while len(l) < min(n // 2, n - len(u)):
	l.append(1)
	ans.append(1)
while len(u) < n - len(l):
	u.append(y)
	ans.append(y)
if sum(l) + sum(u) > x:
	print(-1)
else:
	print(' '.join(map(str, ans)))


(N, K, P, X, Y) = map(int, input().split())
l = input().split()
for i in range(len(l)):
	l[i] = int(l[i])
count = 0
for v in l:
	if v >= Y:
		count += 1
for i in range(max(0, N // 2 + 1 - count)):
	l.append(Y)
while len(l) < N:
	l.append(1)
sum = 0
for v in l:
	sum += v
if len(l) > N or sum > X:
	print(-1)
	quit()
for v in range(K, N):
	print(l[v], end=' ')
print()


def main():
	(n, k, p, x, y) = map(int, input().split())
	aa = list(map(int, input().split()))
	(c, s) = (max(0, (n + 1) // 2 - sum((a >= y for a in aa))), sum(aa))
	print(-1 if c > n - k or s + y * c + n - k - c > x else ' '.join([str(y)] * c + ['1'] * (n - k - c)))
main()


(n, k, p, x, y) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
A = a.copy()
if k == 0:
	for i in range(n // 2):
		a.append(1)
	for i in range(n // 2 + 1):
		a.append(y)
	if sum(a) > x:
		print(-1)
	else:
		print(*a)
elif k >= (n + 1) // 2:
	if a[n // 2] < y:
		print(-1)
		exit()
	else:
		while a[n // 2] >= y and len(a) != n + 1:
			a = [1] + a
		a = a[1:]
		for i in range(n - len(a)):
			a.append(y)
		if sum(a) > x:
			print(-1)
		else:
			for i in A:
				a.remove(i)
			print(*a)
else:
	if a[-1] < y:
		a.append(y)
	while len(a) < (n + 1) // 2:
		a = [1] + a
	while a[n // 2] >= y and len(a) != n + 1:
		a = [1] + a
	a = a[1:]
	for i in range(n - len(a)):
		a.append(y)
	if sum(a) > x:
		print(-1)
	else:
		for i in A:
			a.remove(i)
		print(*a)


(n, k, p, max_p, med) = map(int, input().split())
v = list(map(int, input().split()))
rem_essays = n - k
val = n // 2 + 1 - len([x for x in v if x >= med])
if val < 0 and sum(v) + rem_essays > max_p:
	(print('-1'), exit(0))
if val >= 0:
	if val * med + rem_essays - val + sum(v) > max_p:
		(print('-1'), exit(0))
	if val > rem_essays:
		(print('-1'), exit(0))
	print((str(med) + ' ') * val, end='')
	print('1 ' * (rem_essays - val))
if val < 0:
	print('1 ' * rem_essays)


(n, k, p, x, y) = map(int, input().split())
l = list(map(int, input().split()))
m = 0
for x1 in l:
	if x1 >= y:
		m += 1
t = n // 2 + 1
if m > t:
	t = 0
else:
	t = abs(t - m)
if sum(l) + t * y + abs(n - k - t) > x or p < y or n - k < t:
	print(-1)
	exit()
ans = [y] * t + [1] * (n - k - t)
print(*ans)


(n, k, p, x, y) = map(int, input().split())
a = []
s = input().split()
for i in range(k):
	a += [int(s[i])]
z = (n + 1) // 2
r = 0
v = 0
for i in range(k):
	v += a[i]
	if a[i] >= y:
		r += 1
q = k - r
if q >= z:
	print(-1)
else:
	h = min(z - 1 - q, n - k)
	c = n - k - h
	if h + y * c + v > x:
		print(-1)
	else:
		for i in range(h):
			print('1', end=' ')
		for i in range(c):
			print(str(y), end=' ')


s = input()
(n, k, p, x, y) = s.split()
(n, k, p, x, y) = (int(n), int(k), int(p), int(x), int(y))
s = input()
a = []
for i in s.split():
	a.append(int(i))
sum = 0
l = 0
r = 0
for i in a:
	sum = sum + i
	if i >= y:
		r += 1
	else:
		l += 1
flag = 1
b = []
if sum >= x or l > n // 2 or y > p:
	flag = 0
else:
	left = x - sum
	for i in range(0, n - k):
		if r < n // 2 + 1:
			b.append(y)
			r += 1
		else:
			b.append(1)
		left -= b[i]
	if left < 0 or r < n // 2 + 1:
		flag = 0
if flag == 1:
	for i in range(0, n - k - 1):
		print(b[i], end=' ')
	print(b[n - k - 1])
else:
	print(-1)


from queue import Queue
from queue import PriorityQueue as PQueue
from queue import LifoQueue as Stack
from collections import Counter, defaultdict, deque, OrderedDict
from sys import setrecursionlimit as setreclim
from sys import maxsize
from bisect import bisect_left, bisect, insort_left, insort
import math
from fractions import gcd
from copy import deepcopy
from functools import reduce
from itertools import *
import string
(n, k, p, x, y) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
a.reverse()
if k >= n // 2 + 1:
	med = a[n // 2]
	if med >= y:
		testsum = sum(a) + 1 * (n - k)
		print(-1 if testsum > x else ' '.join(['1' for _ in range(n - k)]))
	else:
		t = a.count(y)
		while len(a) < n and a[n // 2] < y:
			a.append(y)
			a.sort()
			a.reverse()
		leny = a.count(y) - t
		len1 = n - len(a)
		a += [1 for _ in range(len1)]
		print(-1 if a[n // 2] < y or sum(a) > x else ' '.join([str(y) for _ in range(leny)] + ['1' for _ in range(len1)]))
else:
	t = a.count(y)
	while len(a) < n // 2 + 1:
		a.append(y)
	a.sort()
	a.reverse()
	while len(a) < n and a[n // 2] < y:
		a.append(y)
		a.sort()
		a.reverse()
	leny = a.count(y) - t
	len1 = n - len(a)
	a += [1 for _ in range(len1)]
	print(-1 if a[n // 2] < y or sum(a) > x else ' '.join([str(y) for _ in range(leny)] + ['1' for _ in range(len1)]))


(n, k, p, x, y) = map(int, input().split())
l1 = list(map(int, input().split()))
i = l2 = l3 = 0
l1.sort()
while i < k and l1[i] < y:
	i += 1
if i == n:
	l2 = l1 + [y] * (n - k)
	l3 = [0] * k + [1] * (n - k)
else:
	l2 = l1[0:i] + [y] * (n - k) + l1[i:]
	l3 = [0] * i + [1] * (n - k) + (k - i) * [0]
z = sum(l2)
k = (n + 1) // 2 - 1
if z > x:
	j = 0
	while j < k:
		if l3[j] == 1:
			m = l2[j]
			if l2[j] - (z - x) > 0:
				l2[j] -= z - x
			else:
				l2[j] = 1
			z -= m - l2[j]
		if z < x:
			break
		j += 1
	if z > x:
		print(-1)
	else:
		for i in range(n):
			if l3[i] == 1:
				print(l2[i], end=' ')
elif l2[k] < y:
	print(-1)
else:
	for i in range(n):
		if l3[i] == 1:
			print(l2[i], end=' ')


__author__ = 'WildHamster'
(n, k, p, x, y) = map(int, input().split())
s = list(map(int, input().split()))
med = int(n - int(n + 1) / 2 + 1)
k1 = k
for i in s:
	if i >= y:
		med -= 1
	x -= i
while med > 0 and k < n:
	k += 1
	s.append(y)
	x -= y
	med -= 1
while k < n:
	s.append(1)
	x -= 1
	k += 1
if x < 0 or med > 0:
	print(-1)
else:
	for i in range(k1, n):
		print(s[i])


from sys import stdin
(n, k, p, x, y) = map(int, stdin.buffer.readline().split())
a = list(map(int, stdin.buffer.readline().split()))
a.sort()
Sum = 0
id = k
flag = False
for i in range(len(a)):
	Sum += a[i]
	if a[i] >= y and (not flag):
		flag = True
		id = i
if Sum + n - k > x or id > n // 2:
	print(-1)
	exit()
res = list()
for i in range(min(n // 2 - id, n - k)):
	res.append(1)
	Sum += 1
for i in range(min(n // 2 - k + id + 1, n - k)):
	res.append(y)
	Sum += y
if Sum > x:
	print(-1)
else:
	print(*res)


def read_data():
	(n, k, p, x, y) = map(int, input().split())
	As = list(map(int, input().split()))
	return (n, k, p, x, y, As)

def solve(n, k, p, x, y, As):
	middle = n // 2
	As.sort(reverse=True)
	sumA = sum(As)
	minSum = sumA + 1 * (n - k)
	if minSum > x:
		return ['-1']
	num_a_over_y = len([1 for a in As if a >= y])
	if num_a_over_y > middle:
		return ['1'] * (n - k)
	min_num_y = middle + 1 - num_a_over_y
	if min_num_y > n - k:
		return ['-1']
	minSum2 = sumA + min_num_y * y + (n - k - min_num_y) * 1
	if minSum2 > x:
		return ['-1']
	return [str(y)] * min_num_y + ['1'] * (n - k - min_num_y)

def __starting_point():
	(n, k, p, x, y, As) = read_data()
	seq = solve(n, k, p, x, y, As)
	print(' '.join(seq))
__starting_point()


__author__ = 'emcenrue'
(n, k, p, x, y) = map(int, input().split())
totScore = 0
atMed = 0
belowMed = 0
scoresToPrint = list()
curScores = list(map(int, input().split()))
for score in curScores:
	if score >= y:
		atMed += 1
	else:
		belowMed += 1
while len(curScores) < n:
	if belowMed >= atMed:
		curScores.append(y)
		scoresToPrint.append(y)
		atMed += 1
	else:
		curScores.append(1)
		scoresToPrint.append(1)
		belowMed += 1
curScores.sort()
if sum(curScores) > x or curScores[int((n + 1) / 2 - 1)] < y:
	print('-1')
else:
	print(' '.join(map(str, scoresToPrint)))


(n, k, p, x, y) = [int(i) for i in input().split()]
if not k == 0:
	arr = [int(i) for i in input().split()]
	arr.sort()
else:
	arr = []
z = sum([i >= y for i in arr])
mid = (n + 1) // 2
res = []
l = n - mid
for i in range(min(l - z + 1, n - k)):
	res.append(y)
for i in range(n - k - len(res)):
	res.append(1)
if sum(res) + sum(arr) <= x and sorted(arr + res)[mid - 1] >= y:
	for i in res:
		print(i, end=' ')
	print()
else:
	print(-1)


(n, k, p, x, y) = map(int, input().split())
s = 0
kol = 0
sp = []
st = input().split()
for i in range(k):
	s += int(st[i])
	if int(st[i]) < y:
		kol += 1
if kol >= (n + 1) // 2:
	print(-1)
else:
	if k - kol < (n + 1) // 2:
		for i in range(n - k - ((n + 1) // 2 - k + kol)):
			sp.append(1)
			s += 1
		for i in range((n + 1) // 2 - k + kol):
			sp.append(y)
			s += y
	else:
		for i in range(n - k):
			sp.append(1)
			s += 1
	if s > x:
		print(-1)
	else:
		for j in range(n - k):
			print(sp[j], end=' ')


(n, k, p, x, y) = map(int, input().split())
a = map(int, input().split())
(s, l, m) = (x, 0, 0)
for i in a:
	if i < y:
		l += 1
	elif i == y:
		m += 1
	s -= i
r = max(n // 2 + 1 - k + l, 0)
if l > n // 2 or s < n - k - r + r * y:
	print(-1)
else:
	for i in range(r):
		print(y, end=' ')
	for i in range(n - k - r):
		print(1, end=' ')


def no():
	print(-1)
	exit()
(n, k, p, x, y) = map(int, input().split())
if k > 0:
	a = list(map(int, input().split()))
else:
	a = []
a.sort()
xx = sum(a)
nk = n - k
if xx + nk > x or y > x or (x == y and n != 1) or (k * 2 > n and a[-1] < y):
	no()
if n == 1:
	print(x)
	exit()
i = 1
if xx + nk * i <= x:
	ans = []
	sm = xx + nk * i
	b = a + [i] * nk
	b.sort()
	if b[(n + 1) // 2 - 1] < y:
		for j in range(n - 1, -1, -1):
			if b[j] < y:
				j += 1
				break
		m = j - (n + 1) // 2
		if b[(n + 1) // 2 + m - 1] < y:
			m += 1
		if m > nk:
			no()
		if sm + m * (y - i) <= x:
			ans = (nk - m) * [i] + m * [y]
		else:
			no()
	else:
		ans = nk * [i]
	for i in ans:
		print(i, end=' ')


v = input().split()
(n, k, p, x, y) = (int(v[0]), int(v[1]), int(v[2]), int(v[3]), int(v[4]))
b = list(map(int, input().split()))
b.sort()
lower_bound = len(b) - 1
while lower_bound >= 0 and b[lower_bound] >= y:
	lower_bound -= 1
lower_bound += 2
max_count_of_ones = (n + 1) // 2 - lower_bound
total = min(n - k, max_count_of_ones) + sum(b)
if n - k - max_count_of_ones > 0:
	total += y * (n - k - max_count_of_ones)
if total > x or max_count_of_ones < 0 or p < y:
	print(-1)
	exit()
for i in range(min(n - k, max_count_of_ones)):
	print('1', end=' ')
for i in range(min(abs(n - k - max_count_of_ones), n - k - max_count_of_ones)):
	print(y, end=' ')


inputs = input()
inputs = inputs.split(' ')
n = int(inputs[0])
k = int(inputs[1])
p = int(inputs[2])
x = int(inputs[3])
y = int(inputs[4])
if k == 0:
	marks = []
else:
	marks = input()
	marks = marks.split(' ')
marks = [int(number) for number in marks]
if x < sum(marks) + n - k:
	print(-1)
else:
	rest = x - sum(marks) - n + k
	if y == 1:
		middlenumber = n - k
	else:
		middlenumber = rest // (y - 1)
	if middlenumber >= n - k:
		answer = str(y)
		marks.append(y)
		for i in range(n - k - 1):
			answer = answer + ' ' + str(y)
			marks.append(y)
	else:
		halfnumber = x - sum(marks) - middlenumber * y - n + k + middlenumber + 1
		smallnumber = n - k - middlenumber - 1
		answer = str(halfnumber)
		marks.append(halfnumber)
		for i in range(smallnumber):
			answer = answer + ' ' + '1'
			marks.append(1)
		for i in range(middlenumber):
			answer = answer + ' ' + str(y)
			marks.append(y)
	marks.sort()
	if marks[n // 2] >= y:
		print(answer)
	else:
		print(-1)


(n, k, p, x, y) = list(map(int, input().split()))
b = list(map(int, input().split()))
lower_bound = 1
for i in range(k):
	if b[i] < y:
		lower_bound += 1
ans = [1] * min((n + 1) // 2 - lower_bound, n - k)
while len(ans) < n - k:
	ans.append(y)
if sum(ans + b) <= x and (n + 1) // 2 - lower_bound >= 0 and (p >= y):
	print(' '.join(map(str, ans)))
else:
	print('-1')


(n, k, p, x, y) = tuple(map(lambda x: int(x), input().strip().split()))
l = sorted(list(map(lambda x: int(x), input().strip().split())))
ss = sum(l)
idx = k
for i in range(k):
	if l[i] >= y:
		idx = i
		break
part1 = idx
part2 = k - idx
if part1 > n // 2:
	print(-1)
else:
	if part2 > n // 2 + 1:
		fill_y = 0
		fill_1 = n - k
	else:
		fill_y = n // 2 + 1 - part2
		fill_1 = n // 2 - part1
	ss += fill_y * y + fill_1
	if ss > x:
		print(-1)
	else:
		print(' '.join(['1'] * fill_1 + [str(y)] * fill_y))


(n, k, p, maxsum, minmed) = [int(x) for x in input().split()]
left = n - k
stillnow = 0
lessthanmed = 0
ks = [int(x) for x in input().split()]
for i in ks:
	stillnow += i
	if i < minmed:
		lessthanmed += 1
if lessthanmed > n // 2:
	print(-1)
	exit()
minpermit = min(n // 2 - lessthanmed, n - k)
toprint = [1] * minpermit + [minmed] * (n - k - minpermit)
if sum(toprint) + stillnow > maxsum:
	print(-1)
	exit()
print(' '.join([str(x) for x in toprint]))


(n, k, p, x, y) = map(int, input().split())
a = list(map(int, input().split()))
cb = 0
cm = 0
med = 0
ans = []
ind = (n - 1) // 2
c = set()
for i in range(k):
	if a[i] > y and cb < ind:
		c.add(i)
		cb += 1
for i in range(k):
	x -= a[i]
	if i not in c:
		if a[i] >= y and cb < ind + 1:
			cb += 1
		elif a[i] >= y:
			cm += 1
		if a[i] < y:
			cm += 1
if cm > ind or cb > ind + 1:
	print(-1)
	exit()
for i in range(ind - cm):
	ans.append(1)
	x -= 1
for i in range(ind + 1 - cb):
	ans.append(y)
	x -= y
if x < 0:
	print(-1)
else:
	print(*ans)


def main():
	(n, k, p, x, y) = map(int, input().split())
	v = input().split()
	sum = 0
	small = 0
	v.sort()
	for mark in v:
		sum += int(mark)
		if int(mark) < y:
			small += 1
	if small >= (n + 1) // 2:
		print(-1)
	else:
		ans = []
		for i in range(n - k):
			if small + 1 >= (n + 1) // 2:
				sum += y
				ans.append(y)
			else:
				sum += 1
				small += 1
				ans.append(1)
		if sum > x:
			print(-1)
		else:
			print(*ans, sep=' ')
main()


(n, k, p, x, y) = (int(x) for x in input().split())
alreadyGot = [int(x) for x in input().split()]
countToWrite = n - k
maxSumToWrite = x - sum(alreadyGot)
if maxSumToWrite < 0:
	print(-1)
else:
	newMarks = [1 for i in range(n - k)]
	maxSumToWrite -= n - k
	if maxSumToWrite < 0:
		print(-1)
	else:
		newMarksIt = 0
		while maxSumToWrite - (y - 1) >= 0 and newMarksIt < len(newMarks):
			newMarks[newMarksIt] = y
			maxSumToWrite -= y - 1
			newMarksIt += 1
		for i in range(len(newMarks)):
			alreadyGot.append(newMarks[i])
		alreadyGot.sort()
		if alreadyGot[len(alreadyGot) // 2] >= y:
			print(' '.join([str(i) for i in newMarks]))
		else:
			print(-1)


(n, k, p, x, y) = map(int, input().split())
q = list(map(int, input().split()))
(cy, cx) = (0, 0)
for i in q:
	cy += i < y
if cy > (n - 1) // 2:
	print(-1)
else:
	w = []
	for i in range(min(n - k, n // 2 - cy)):
		w.append(1)
	while len(w) < n - k:
		w.append(y)
	if sum(q) + sum(w) > x:
		print(-1)
	else:
		print(*w)


(n, k, p, x, y) = map(int, input().split())
if not k:
	half = n - 1 >> 1
	if y * (half + 1) + half <= x:
		x = [y] * (half + 1) + [1] * half
		print(*x)
	else:
		print(-1)
else:
	arr = [int(x) for x in input().split()]
	cnt = 0
	cnt1 = 0
	equal = 0
	half = n - 1 >> 1
	for (idx, val) in enumerate(arr):
		if val < y:
			cnt += 1
		if val > y:
			cnt1 += 1
		if val == y:
			equal += 1
	ok = True
	if cnt > half:
		ok = False
	else:
		more = [1] * min(half - cnt, n - k)
		ans = [i for i in more]
		arr.extend(more)
		med = [y] * (n - len(arr))
		arr.extend(med)
		ans.extend(med)
		arr.sort()
		if sum(arr) <= x and arr[half + 1] >= y:
			print(*ans)
		else:
			ok = False
	if not ok:
		print(-1)


__author__ = 'huash06'
import sys
import os
import itertools
import collections
import functools
import bisect
import datetime
(n, k, p, x, y) = list(map(int, input().split()))
exits = list(map(int, input().split()))
half = n // 2
if x < y:
	print(-1)
elif n <= 1:
	if p >= x:
		print(x)
	else:
		print(-1)
elif not exits:
	if p < y or half + y * (half + 1) > x:
		print(-1)
	else:
		l = (x - y * (half + 1)) // half
		if l < 1:
			print(-1)
		else:
			res = [y] * (n // 2 + 1) + [l] * half
			print(' '.join(list(map(str, res))))
else:
	exsum = sum(exits)
	if len(exits) >= n:
		print(-1)
	elif exsum + (n - len(exits)) > x:
		print(-1)
	else:
		median = y
		left = list(filter(lambda x: x < median, exits))
		right = list(filter(lambda x: x >= median, exits))
		if len(left) > n // 2:
			median = sorted(left)[n // 2]
		elif len(right) > n // 2:
			median = sorted(right)[len(right) - n // 2 - 1]
		left = list(filter(lambda x: x < median, exits))
		right = list(filter(lambda x: x >= median, exits))
		res = []
		if len(right) > n // 2:
			left.extend(right[:len(right) - n // 2])
			right = right[len(right) - n // 2:]
		elif len(left) > n // 2:
			right.extend(left[n // 2:])
			left = left[:n // 2]
		noMedian = False
		if left and left[-1] >= median:
			left = left[:-1]
		elif right and len(right) > 0:
			right = right[1:]
		else:
			noMedian = True
		lenRigh = n // 2 - len(right)
		lenLeft = n // 2 - len(left)
		if noMedian:
			lenRigh += 1
		if median < y or exsum + lenLeft + median * lenRigh > x:
			print(-1)
		else:
			maxsum = x - exsum
			minsum = max(lenLeft + lenRigh * y - exsum, 1)
			if lenRigh == 0:
				v = max(minsum // lenLeft, 1)
				for i in range(lenLeft):
					if minsum > lenLeft and i < minsum % lenLeft:
						res.append(v + 1)
					else:
						res.append(v)
				print(' '.join(list(map(str, res))))
			elif lenLeft == 0:
				v = max(minsum // lenRigh, median)
				for i in range(lenRigh):
					res.append(v)
				print(' '.join(list(map(str, res))))
			else:
				rightSum = min(lenRigh * p, maxsum - lenLeft)
				lefSum = max(minsum - rightSum, lenLeft)
				v = lefSum // lenLeft
				for i in range(lenLeft):
					if lefSum > lenLeft and i < lefSum % lenLeft:
						res.append(v + 1)
					else:
						res.append(v)
				v = rightSum // lenRigh
				for i in range(lenRigh):
					if rightSum > lenRigh and i < rightSum % lenRigh:
						res.append(v + 1)
					else:
						res.append(v)
				print(' '.join(list(map(str, res))))