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.

Difficulty: introductory

Starter code:

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): # iは最後のテストの点数、0から増やしていく。満点kの時まで繰り返すためにk+1
    total= score + i
    avarage = total / n
#    print(i,'total',total,'avarage',avarage)
    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 点満点であり、点数はそれぞれ 0 以上の整数です。
高橋君は N−1 科目のテストを既に受けており、
i 番目の科目のテストの点数は Ai 点でした。
高橋君の目標は、N 科目のテストの平均点を M 点以上にすることです。
高橋君が目標を達成するためには、最後のテストで最低何点取る必要があるか出力してください。
達成不可能である場合は、代わりに -1 を出力してください。
"""

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 点以上
# 最後のテストで最低何点取る必要があるか : answer
# 達成不可能である場合は、代わりに -1 を出力

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))
else:
  if 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(科目数)、M(平均点)、K(満点):標準入力
N, K, M = map(int, input().split())
A = list(map(int, input().split()))

# 最後のテストの最低点
worst_score = sum(A)

# 最後の平均点の値
score = (N * M) - worst_score

if score <= K:
    if score > 0:
        print(score)
    else:
        print(0)
else:
    print(-1)

#151b
#1.値を受け取る
N, K, M = map(int, input().split())
A = list(map(int, input().split()))

#2.残りのテストで何点取れは大丈夫か判断する。
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())
a = list(map(int,input().split()))

p = n*m - sum(a)
if p > k :
  ans = -1
elif p < 0:
  ans = 0
else:
  ans = p

print(ans)

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())
a=list(map(int,input().split()))
b=m*n-sum(a)
if 0<=b<=k:
    print(b)
elif b<0:
    print(0)
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()))
x = max(0, m*n - sum(a))
print(x if x <= k else -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())
A = list(map(int,input().split()))
AA = sum(A)


for i in range(K+1):
    if N*M <= sum(A)+i:
        print(i)
        return

print(-1)

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())
scores = list(map(int,input().split()))

x = M * N - sum(scores)

if x > K:
    print("-1")
if 0 < x <= K:
    print(x)
if x <= 0:
    print(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)


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


# abc151B
# https://atcoder.jp/contests/abc151/tasks/abc151_b

# Ｎ科目テスト　各テストＫ点満点
# Ｎ-1科目のテストを受け、
# i番目の科目のテスト点数はＡi点
# Ｎ科目の平均点をＭ点以上にする
# 最後のテストで最低何点取る必要があるか

# 達成負不可の場合は"-1"を出力

# 入力
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())
a=list(map(int,input().split()))
x=m*n-sum(a)
if x>k:
       print(-1)
elif x>0:
        print(x)
else:
    print(0)

N,K,M=map(int,input().split())
A=list(map(int,input().split()))
if M*N-sum(A)<= K:
    print(max(M*N-sum(A),0))
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())
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())

ans = n*m - sum(a)
if ans < 0:
  print(0)
elif ans > k:
  print(-1)
else:
  print(ans)

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

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

if (sum(A) + K) / N < M:
    print(-1)
elif sum(A) / N >= M:
    print(0)
else:
    print(M * N - sum(A))

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

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

ans = N * M - sum(A)

if ans < 0:
    print(0)
elif ans > K:
    print(-1)
else:
    print(ans)

n,k,m = map(int,input().split())
a = list(map(int,input().split()))

if m > (sum(a) + k) / (len(a) + 1):
    print(-1)
elif m < (sum(a)) / (len(a) + 1):
    print(0)
else:
    print((m * (len(a) + 1)) - sum(a) )

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)

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)

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科目のテストを受けます。各テストは K点満点であり、点数はそれぞれ 0以上の整数です。
# 高橋君は N−1科目のテストを既に受けており、i番目の科目のテストの点数は Ai点でした。
# 高橋君の目標は、N科目のテストの平均点を M点以上にすることです。
# 高橋君が目標を達成するためには、最後のテストで最低何点取る必要があるか出力してください。
# 達成不可能である場合は、代わりに -1 を出力してください。

# n(科目数)、m(平均点)、k(満点):標準入力
n, k, m = map(int, input().split())
a = list(map(int, input().split()))

# 最後のテストの最低点
last_score = sum(a)

# 最後の平均点の値
score = (n * m) - last_score

if score <= k:
    if score > 0:
        print(score)
    else:
        print(0)
else:
    print(-1)

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


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 = map(int, input().split())
a = list(map(int, input().split()))

a1 = sum(a)
ans = (n * m - a1)
if ans > k:
    print(-1)

elif ans < 0:
    print(0)

else:
    print(ans)

n,k,m = map(int, input().split())
a = map(int, input().split())

score = sum(a) # 今までのテストの合計点

for i in range(k + 1): # iは最後のテストの点数、0から増やしていく。満点kの時まで繰り返すためにk+1
    total = score + i # 最後のテストの点数を足す
    avarage = total / n # 全体の平均点を出す
#    print(i,'total',total,'avarage',avarage) # 動作テスト用
    if avarage >= m: # 平均点が、必要平均点mと同じか上回ったら・・・
        print(i) # 最後のテストの点数をprint
        break # forを終了する
    if i == k: # 最後のテストの点数が満点になっても必要平均点mを上回らなかったら-1と出力
        print('-1') 


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 = list(map(int, input().split()))

x = (M * N) - sum(A)
if x < 0:
    print("0")
elif x <= K:
    print(x)
else:
    print("-1")

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は平均点
#　Aは取ったスコアのリスト
N, K, M = map(int, input().split())
A = list(map(int, input().split()))

#　必要なスコアの計算
need_score = N * M - sum(A)

#　need_scoreがKより大きいとき
if K >= need_score:
    if need_score <=0:
        print(0)
    else:
        print(need_score)
# need_scoreがKより小さいので、挽回不可
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=map(int,input().split())
a=list(map(int,input().split()))
x=m*n-sum(a)
if x>k:
    print(-1)
elif x>0:
    print(x)
else:
    print(0)

n, k, m = map(int, input().split())
a = list(map(int, input().split()))

x = m*n - sum(a) 

if x <= k and x > 0:
    print(x)
elif x <= k:
    print(0)
else:
    print(-1)

N, K, M = list(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 点満点であり、点数はそれぞれ 0 以上の整数です。

    高橋君は N−1 科目のテストを既に受けており、
    i 番目の科目のテストの点数は Ai 点でした。

    高橋君の目標は、N 科目のテストの平均点を M 点以上にすることです。
    高橋君が目標を達成するためには、最後のテストで最低何点取る必要があるか出力してください。
    達成不可能である場合は、代わりに -1 を出力してください。
'''

'''
制約：
    2 ≦ N ≦ 100
    1 ≦ K ≦ 100
    1 ≦ M ≦ K
    0 ≦ Ai ≦ K
    入力中のすべての値は整数である
'''
# class Test:
#     points = []
#     def __init__(self, point):
#         self.point = point
#
#     def add_test(self):
#         self.points.append(self)
#
#     def lasttest_min(self, target_point)   -> int:
#         target_point - ave(points)

# 標準入力から N, K, M, Ai の値を取得する
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)   # N番目のテストで目標達成に必要な点数

result = "ret"
if need_point_n > k:
    result = -1
else:
    if need_point_n < 0:    # N番目が 0点でも目標達成できる場合
        result = 0
    else:
        result = need_point_n

print(result)


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())
a = list(map(int, input().split()))
x = max(0, m*n-sum(a))
print(x if x <= k else -1)

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

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

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

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

A = list(map(int, input().split()))

ans = max(0, M*N-sum(A))

ans = ans if ans <= K else -1

print(ans)



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("\033[33m", *a, "\033[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())
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満点。0以上の整数。
# 高橋君N-1科目受講済み
# i番目の科目の点数はA1点　A＝list(map(int.input().split())使う
# 目標　N科目のテストの平均点をM以上にする。　最低点数N×M
# 目標達成の為には最後のテストで最低何点とる必要があるか出力せよ。　N科目×M点-総合点数A点
# 達成不可能な場合-1を出力。 print(-1)
#

# 入力
# N K M
# A1 A2…An-1
# 出力
# 最後のテストでの必要最低点または-1


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

if 0 <= (N*M)-sum(A) <= K:
    print((N*M)-sum(A))

elif K < (N*M)-sum(A):
    print(-1)

else:  # 0でも達成
   print(0)

N, K, M = list(map(int, input().split()))
A = list(map(int, input().split()))
X = M * N - sum(A)

if X <= K and X >= 0:
    print(X)
elif X <= K and X < 0:
    print("0")
else:
    print("-1")


n, k, m = map(int, input().split())
a = list(map(int, input().split()))

ans = max(0, m*n-sum(a)) if m*n-sum(a)<=k else -1
print(ans)

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

n,k,m = map(int,input().split())
a = list(map(int,input().split()))

# 満点Kをとっても平均ｍにならないときには-1
if m > (sum(a) + k) / (len(a) + 1):
    print(-1)
# 0点をとっても平均ｍ以上になるときには０
elif m < (sum(a)) / (len(a) + 1):
    print(0)
# 上記で無い場合には平均ｍとなる整数を出力
else:
    print((m * (len(a) + 1)) - sum(a) )

n,k,m = map(int,input().split())
a = list(map(int,input().split()))

# これまでの点数sum(a)を満点kを併せても平均mにならなければ-1
if sum(a) + k < n * m :
    print(-1)
# 0点をとっても平均mになるようなら0
elif (n * m) < sum(a):
    print(0)
# 上記でなければ平均mになるために必要な点数を出力
else:
    print((n*m)-sum(a))

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())
a = list(map(int,input().split()))
need = m*n-sum(a)
print(0 if need<0 else need if need<=k else -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)))



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

x=M*N-sum(A)

if K>=x:
    if x<=0:
        print(0)
    else:
        print(x)

else:
    print(-1)

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