Takahashi is taking exams on N subjects. The score on each subject will be an integer between 0 and K (inclusive).
He has already taken exams on N-1 subjects and scored A_i points on the i-th subject.
His goal is to achieve the average score of M points or above on the N subjects.
Print the minimum number of points Takahashi needs on the final subject to achieve his goal.
If the goal is unachievable, print -1 instead.

-----Constraints-----
 - 2 \leq N \leq 100
 - 1 \leq K \leq 100
 - 1 \leq M \leq K
 - 0 \leq A_i \leq K
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
N K M
A_1 A_2 ... A_{N-1}

-----Output-----
Print the minimum number of points required on the final subject, or -1.

-----Sample Input-----
5 10 7
8 10 3 6

-----Sample Output-----
8

If he scores 8 points on the final subject, his average score will be (8+10+3+6+8)/5 = 7 points, which meets the goal.

Source: atcoder | Difficulty: EASY


Solutions:
(N, K, M) = map(int, input().split())
A = list(map(int, input().split()))

def score():
	max_aim = M * N
	last_score = max_aim - sum(A)
	if last_score <= 0:
		return 0
	elif 0 < last_score <= K:
		return last_score
	elif K < last_score:
		return -1
print(score())


(N, K, M) = map(int, input().split())
A = list(map(int, input().split()))
now_total = 0
target_total = N * M
for i in A:
	now_total += i
target_point = target_total - now_total
if 0 < target_point <= K:
	print(target_point)
elif target_point <= 0:
	print(0)
else:
	print(-1)


(N, K, M) = list(map(int, input().split()))
A1 = list(map(int, input().split()))
add = []
for i in range(0, K + 1):
	if (sum(A1) + i) // N >= M:
		add.append(i)
	else:
		pass
if not add:
	print(-1)
elif K > max(add):
	print(-1)
else:
	print(min(add))


(n, k, m) = map(int, input().split())
a = map(int, input().split())
score = sum(a)
for i in range(k + 1):
	total = score + i
	avarage = total / n
	if avarage >= m:
		print(i)
		break
	if i == k:
		print('-1')


(N, K, M) = list(map(int, input().split()))
A = list(map(int, input().split()))
Point = M * N - sum(A)
if Point >= 0 and Point <= K:
	print(Point)
elif Point > K:
	print(-1)
else:
	print(0)


(N, K, M) = list(map(int, input().split()))
score = list(map(int, input().split()))
ans = N * M - sum(score)
if ans > K:
	ans = -1
elif ans < 0:
	ans = 0
print(ans)


(n, k, m) = list(map(int, input().split()))
total = sum(list(map(int, input().split())))
lowest_score = m * n
add_score = lowest_score - total
if add_score <= 0:
	print(0)
elif add_score > k:
	print(-1)
else:
	print(add_score)


import sys
(n, k, m) = map(int, input().split())
A = list(map(int, input().split()))
sum1 = sum(A)
gou = n * m
if gou <= sum1:
	print('0')
	return
if gou > sum1:
	if gou - sum1 > k:
		print('-1')
		return
	print(gou - sum1)


(N, K, M) = map(int, input().split())
scores = list(map(int, input().split()))
achieve_score = N * M
answer = achieve_score - sum(scores)
if answer <= 0:
	print(0)
elif answer <= K:
	print(answer)
else:
	print('-1')


(N, K, M) = map(int, input().split())
A = list(map(int, input().split()))
answer = 0
Sum = 0
for i in range(N - 1):
	Sum += A[i]
a = M * N - Sum
if a <= 0:
	print(0)
elif a <= K:
	answer = a
	print(answer)
else:
	print(-1)


(n, k, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
req = m * n - sum(a)
print(max(0, req) if req <= k else -1)


def resolve():
	(n, k, m) = map(int, input().split())
	a = tuple(map(int, input().split()))
	ans = n * m - sum(a)
	print(max(ans, 0) if ans <= k else -1)
resolve()


(n, k, m) = map(int, input().split())
a = list(map(int, input().split()))
if sum(a) + k < n * m:
	print(-1)
else:
	for i in range(k + 1):
		if sum(a) + i > n * m:
			print(0)
			break
		if sum(a) + i == n * m:
			print(i)
			break


(n, k, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
if n * m - sum(a) > k:
	print(-1)
elif n * m - sum(a) < 0:
	print(0)
else:
	print(n * m - sum(a))


(N, K, M) = list(map(int, input().split()))
A = list(map(int, input().split()))
answer = N * M - sum(A)
if answer <= K:
	if answer < 0:
		print('0')
	else:
		print(answer)
else:
	print('-1')


(N, K, M) = map(int, input().split())
S = map(int, input().split())
total_score = sum(S)

class Achieve:

	def __init__(self, subjects, points, goal):
		self.subjects = subjects
		self.points = points
		self.goal = goal

	def calculation(self):
		ans = self.subjects * self.goal - total_score
		if ans > self.points:
			return '-1'
		if ans < 0:
			return 0
		else:
			return ans
takahasi = Achieve(N, K, M)
print(takahasi.calculation())


(N, K, M) = map(int, input().split())
scores = list(map(int, input().split()))
x = M * N - sum(scores)
if x > K:
	print('-1')
elif 0 < x:
	print(x)
else:
	print(0)


(N, K, M) = map(int, input().split())
A = list(map(int, input().split()))
score = sum(A)
if N * M - score > K:
	print(-1)
else:
	print(max(N * M - score, 0))


(n, k, m) = (int(n) for n in input().split())
list_a = [int(n) for n in input().split()]
if n * m <= sum(list_a) + k and n * m - sum(list_a) > 0:
	print(n * m - sum(list_a))
elif n * m - sum(list_a) <= 0:
	print('0')
else:
	print('-1')


(N, K, M) = [int(n) for n in input().split()]
A = sum([int(n) for n in input().split()])
score = N * M - A
if score <= K:
	print(max(0, score))
else:
	print(-1)


(N, K, M) = map(int, input().split())
scores = list(map(int, input().split()))
answer = max(M * N - sum(scores), 0)
if answer <= K:
	print(answer)
else:
	print('-1')


(n, k, m) = map(int, input().split())
a = n * m - sum(map(int, input().split()))
print([0, [-1, a][a <= k]][a >= 0])


(N, K, M) = map(int, input().split())
score = list(map(int, input().split()))
for i in range(K + 1):
	if (sum(score) + i) / N >= M:
		print(i)
		return
print(-1)


(N, K, M) = map(int, input().split())
A = list(map(int, input().split()))
SUM = 0
AVG = 0
A_N = 0
while AVG <= M:
	for i in range(0, N - 1):
		SUM += A[i]
	SUM += A_N
	AVG = int(SUM / N)
	if AVG >= M:
		break
	SUM = 0
	A_N += 1
if A_N > K:
	print('-1')
else:
	print(A_N)


(N, K, M) = map(int, input().split())
Alist = list(map(int, input().split()))
i = 0
temp = 0
flag = False
for i in range(0, K + 1):
	mean = (sum(Alist) + i) // N
	if M <= mean:
		temp = i
		flag = True
		break
if flag == True:
	print(temp)
else:
	print(-1)


(sub_num, full_score, average) = map(int, input().split())
scores = list(map(int, input().split()))
required_score = average * sub_num - sum(scores)
if full_score >= required_score:
	if required_score <= 0:
		print(0)
	else:
		print(required_score)
else:
	print(-1)


(n, k, m) = map(int, input().split())
a = list(map(int, input().split()))
ai = 0
for i in range(n - 1):
	ai += a[i]
ans = n * m - ai
if ai < n * m and ans <= k:
	print(ans)
elif ai < n * m and ans > k:
	print(-1)
else:
	print(0)


(n, k, m) = map(int, input().split())
lst = [int(i) for i in input().split()]
sa = n * m
x = sum(lst)
if sa - x > k:
	print(-1)
else:
	print(max(sa - x, 0))


(N, K, M) = map(int, input().split())
(*A,) = map(int, input().split())
x = N * M - sum(A)
print(-1 if x > K else max(0, x))


(N, K, M) = list(map(int, input().split()))
score = list(map(int, input().split()))
sum_score = sum(score)
answer = N * M - sum_score
if answer > K:
	print('-1')
elif answer <= 0:
	print('0')
else:
	print(answer)


(N, K, M) = list(map(int, input().split()))
A = list(map(int, input().split()))
X = M * N - sum(A)
if X > K:
	print('-1')
elif 0 <= X <= K:
	print(X)
else:
	print('0')


(n, k, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sum(a)
score = n * m - a
if score <= k:
	answer = score if score > 0 else '0'
	print(answer)
else:
	print('-1')


(N, K, M) = map(int, input().split())
A = list(map(int, input().split()))
all = sum(A)
goal = M * N
last = goal - all
if last > K:
	print(-1)
elif last < 0:
	print(0)
else:
	print(last)


(N, K, M) = map(int, input().split())
data = list(map(int, input().split()))
sum_data = sum(data)
result = N * M - sum_data
if result > K:
	print('-1')
elif result <= 0:
	print('0')
else:
	print(result)


(n, k, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
sum1 = sum(a)
stock = sum1
check = n * m
flag = 0
for i in range(k + 1):
	sum1 += i
	if check <= sum1:
		ans = i
		flag = 1
		break
	sum1 = stock
if flag == 0:
	print(-1)
else:
	print(ans)


(n, k, m) = map(int, input().split())
aa = list(map(int, input().split()))
sum_aa = sum(aa)
x = n * m - sum_aa
if 0 <= x <= k:
	print(x)
elif x > k:
	print(-1)
elif x < 0:
	print(0)


(n, k, m) = map(int, input().split())
a = list(map(int, input().split()))
g = n * m
for i in a:
	g -= i
print(max(g, 0) if g <= k else -1)


(n, k, m) = map(int, input().split())
A = list(map(int, input().split()))
aim = n * m
p = sum(A)
if aim - p < 0:
	print(0)
elif aim - p > k:
	print(-1)
elif aim - p <= k:
	print(aim - p)


def hantei(n, k, m, a_sum):
	if a_sum / n >= m:
		return 0
	if (a_sum + k) / n >= m:
		return m * n - a_sum
	return -1
(n, k, m) = map(int, input().split())
a = list(map(int, input().split()))
a_sum = sum(a)
print(hantei(n, k, m, a_sum))


n = input()
n = n.split()
m = int(n[2])
k = int(n[1])
n = int(n[0])
a = input()
a = a.split()
b = int(a[0])
for c in range(n - 2):
	b = b + int(a[c + 1])
if b >= m * n:
	print(0)
elif b + k < m * n:
	print(-1)
else:
	print(m * n - b)


(N, maxscore, avgscore) = map(int, input().split())
A = list(map(int, input().split()))
goaltotal = N * avgscore
currenttotal = sum(A)
if goaltotal - currenttotal > maxscore:
	print(-1)
elif goaltotal - currenttotal < 0:
	print(0)
else:
	print(goaltotal - currenttotal)


(n, k, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
result = m * n - sum(a)

def show_result():
	if result > k:
		return -1
	elif 1 <= result <= k:
		return result
	elif result <= 0:
		return 0
print(show_result())


(n, k, m) = map(int, input().split())
a = map(int, input().split())
sum_Score = sum(a)
good = m * n - sum_Score
if good > k:
	print('-1')
else:
	print(max(good, 0))


(N, K, M) = map(int, input().split())
A = map(int, input().split())
score = M * N - sum(A)
if score <= 0:
	print(0)
elif score <= K:
	print(score)
else:
	print('-1')


(n, k, m) = map(int, input().split())
li = list(map(int, input().split()))
su = sum(li)
x = m * n - su
if x > k:
	print('-1')
elif x < 0:
	print(0)
else:
	print(x)


(n, k, m) = list(map(int, input().split()))
scores = list(map(int, input().split()))
N_score = m * n - sum(scores)
if N_score < 0:
	print(0)
elif k < N_score:
	print(-1)
else:
	print(N_score)


(N, K, M) = map(int, input().split())
score = list(map(int, input().split()))
lastscore = N * M - sum(score)
if lastscore <= 0:
	print('0')
elif K >= lastscore:
	print(lastscore)
else:
	print('-1')


(n, k, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
target_ponits = m * n
need_point_n = target_ponits - sum(a)
result = 'ret'
if need_point_n > k:
	result = -1
elif need_point_n < 0:
	result = 0
else:
	result = need_point_n
print(result)


(n, k, m) = map(int, input().split())
a = tuple(map(int, input().split()))
total = sum(a)
for i in range(k + 1):
	if (total + i) / n >= m:
		print(i)
		return
print('-1')


import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda : int(sys.stdin.readline())
inl = lambda : [int(x) for x in sys.stdin.readline().split()]
ins = lambda : sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print('\x1b[33m', *a, '\x1b[0m', **dict(file=sys.stderr, **kw))

def solve():
	(n, k, m) = inl()
	a = inl()
	s = sum(a)
	y = m * n - s
	if y > k:
		return -1
	return max(y, 0)
print(solve())


(N, K, M) = map(int, input().split())
A = [int(i) for i in input().split()]
ans = M * N
for i in range(N - 1):
	ans -= A[i]
if ans > K:
	print(-1)
	return
if ans <= 0:
	print(0)
	return
print(ans)


(n, k, m) = map(int, input().split())
list01 = list(map(int, input().split()))
score01 = n * m
score02 = sum(list01)
if 0 < score01 - score02 <= k:
	print(score01 - score02)
elif score01 - score02 <= 0:
	print(0)
else:
	print('-1')


(N, K, M) = list(map(int, input().split()))
A = list(map(int, input().split()))
score = 0
for i in range(N - 1):
	score += A[i]
ans = M * N - score
if 0 <= ans <= K:
	print(ans)
elif ans < 0:
	print(0)
else:
	print(-1)


(N, K, M) = map(int, input().split())
arr = list(map(int, input().split()))
num = sum(arr)
ideal = N * M
sa = ideal - num
if sa > K:
	print(-1)
elif sa <= 0:
	print(0)
else:
	print(sa)


(N, K, M) = list(map(int, input().split()))
A = list(map(int, input().split()))

def answer(N: int, K: int, M: int, A: list) -> int:
	A = sum(A)
	if max(0, M * N - A) > K:
		return -1
	else:
		return max(0, M * N - A)
print(answer(N, K, M, A))