ZhenlongDai/ACPR huggingface dataset:
Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m=map(int,input().split())
a=list(map(int,input().split()))
print(n-sum(a))

Failing test case input:
253 15
8 23 12 34 5 16 79 3 23 8 46 0 0 70 1

Expected output:
-1


Actual output:
-75


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
a=sum(list(map(int,input().split())))
if n-a>=0:
    print(n-a)
else:
    print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
m, n = map(int, input().split())
l = [int(x) for x in input().split()]
s = sum(l)
if s > m:
    print(-1) 
print(m-s)    



Failing test case input:
0 1
5 2

Expected output:
-1


Actual output:
-1
-7


Fixed submission (verdict: Accepted):
m, n = map(int, input().split())
l = [int(x) for x in input().split()]
s = sum(l)
if s > m:
    print(-1) 
else:
    print(m-s)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = sum(a)
if b < n:
    print(n - b)
else:
    print("-1")

Failing test case input:
11 2
5 6

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = sum(a)
if b <= n:
    print(n - b)
else:
    print("-1")

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
a = list(map(int,input().split()))
for i in a:
  n -= i
print(n)

Failing test case input:
-2 1
5 1

Expected output:
-1


Actual output:
-8


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
a = list(map(int,input().split()))
for i in a:
  n -= i
if n >=0:
  print(n)
else:
  print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(1)
	n, m = map(int, sys.stdin.readline().split())
	a = list(map(int, sys.stdin.readline().split()))
	print(n-sum(a))
	


main()

Failing test case input:
0 1
5 2

Expected output:
-1


Actual output:
-7


Fixed submission (verdict: Accepted):


import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(1)
	n, m = map(int, sys.stdin.readline().split())
	a = list(map(int, sys.stdin.readline().split()))
	if n - sum(a) >= 0:
		print(n-sum(a))
	else:
		print(-1)
	


main()

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n_vacations, n_an = list(map(int, input().split()))
an = list(map(int, input().split()))

print(n_vacations - sum(an))

Failing test case input:
253 15
9 23 5 35 8 9 79 3 23 8 46 2 1 47 3

Expected output:
-1


Actual output:
-48


Fixed submission (verdict: Accepted):
n_vacations, n_an = list(map(int, input().split()))
an = list(map(int, input().split()))
out = n_vacations - sum(an) 
if out < 0:
  print("-1")
else:
  print(out)
Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M= map(int,input().split())
homeworks = list(map(int, input().split()))
for homework in homeworks:
  N-=homework
print(N)

Failing test case input:
253 15
8 23 6 35 8 16 79 3 23 8 46 2 0 47 3

Expected output:
-1


Actual output:
-54


Fixed submission (verdict: Accepted):
N,M= map(int,input().split())
homeworks = list(map(int, input().split()))
for homework in homeworks:
  N-=homework
if N>=0:
  print(N)
else:
  print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
a = [int(i) for i in input().split()]
ans = n - sum(a)
if n >= 0:
    print(ans)
else:
    print(-1)

Failing test case input:
253 15
8 23 6 35 5 16 79 3 23 8 46 0 0 70 5

Expected output:
-1


Actual output:
-74


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
a = [int(i) for i in input().split()]
ans = n - sum(a)
if ans >= 0:
    print(ans)
else:
    print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split(' '))
a = list(map(int, input().split(' ')))

print(n - sum(a))

Failing test case input:
-2 1
5 1

Expected output:
-1


Actual output:
-8


Fixed submission (verdict: Accepted):
n, m = map(int, input().split(' '))
a = list(map(int, input().split(' ')))

ret = n - sum(a)
if ret < 0:
    print(-1)
else:
    print(ret)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m=map(int, input().split())
a = list(map(int, input().split()))
ans =  n - sum(a)
if 0 < ans:
    print(ans)
else:
    print('-1')


Failing test case input:
11 2
5 6

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n, m=map(int, input().split())
a = list(map(int, input().split()))
ans =  n - sum(a)
if 0 <= ans:
    print(ans)
else:
    print('-1')

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M = map(int,input().split(" "))
A = [int(e) for e in input().split(" ")]



if N - sum(A) <= 0:
    print(-1)
else:
    print(N - sum(A))

Failing test case input:
1 2
0 1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
N,M = map(int,input().split(" "))
A = [int(e) for e in input().split(" ")]



if N - sum(A) < 0:
    print(-1)
else:
    print(N - sum(A))

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
days,num = map(int,input().split())
homeworks = list(map(int,input().split()))

temp = sum(homeworks)

if temp > days:
    print(-1)
else:
    print(days-days)


Failing test case input:
68 2
9 9

Expected output:
50


Actual output:
0


Fixed submission (verdict: Accepted):
days,num = map(int,input().split())
homeworks = list(map(int,input().split()))

temp = sum(homeworks)

if temp > days:
    print(-1)
else:
    print(days-temp)
Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m = map(int,input().split())
a = list(map(int,input().split()))
if (sum(a) < n):
    print(n-sum(a))
else:
    print(-1)

Failing test case input:
11 2
5 6

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())
a = list(map(int,input().split()))
if (sum(a) <= n):
    print(n-sum(a))
else:
    print(-1)

Problem: p02706
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N,M = map(int,input().split())
A = list(map(int,input().split()))
a = sum(A)
if N > a:
    print(N-a)
else:
    print(-1)

Failing test case input:
1 2
0 1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
A = list(map(int,input().split()))
a = sum(A)
if N >= a:
    print(N-a)
else:
    print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())
A = list(map(int, input().split()))
ans = N - sum(A)
print(ans)


Failing test case input:
253 15
8 23 6 35 8 9 79 3 23 8 46 2 0 47 3

Expected output:
-1


Actual output:
-47


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
A = list(map(int, input().split()))
ans = max(N - sum(A), -1)
print(ans)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m = map(int, input().split())
a = map(int, input().split())
print(n-sum(a))

Failing test case input:
253 15
8 23 6 35 8 9 79 3 23 8 46 2 1 47 3

Expected output:
-1


Actual output:
-48


Fixed submission (verdict: Accepted):
n,m = map(int, input().split())
a = map(int, input().split())
b = sum(a)
if n < b:
    print("-1")
else:
    print(n-b)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M=list(map(int, input().split()))
A=list(map(int, input().split()))
ans=sum(A)
if N<ans:
    print('-1')
else:
    print(M-ans)

Failing test case input:
78 2
8 16

Expected output:
54


Actual output:
-22


Fixed submission (verdict: Accepted):
N,M=list(map(int, input().split()))
A=list(map(int, input().split()))
ans=sum(A)
if N<ans:
    print('-1')
else:
    print(N-ans)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
a = list(map(int, input().split()))
ans = n
for i in a:
  ans -= i

print(ans)

Failing test case input:
253 15
9 23 5 35 8 9 79 3 23 8 46 2 1 47 3

Expected output:
-1


Actual output:
-48


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
a = list(map(int, input().split()))
ans = n
for i in a:
  ans -= i

if ans < 0:
  print(-1)
else:
  print(ans)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m = list(map(int,input().split()))
A = list(map(int,input().split()))
for a in A:
  n -= a

print(max(0,n))

Failing test case input:
-2 1
2 1

Expected output:
-1


Actual output:
0


Fixed submission (verdict: Accepted):
n,m = list(map(int,input().split()))
A = list(map(int,input().split()))
for a in A:
  n -= a

print(max(-1,n))
Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())
A = [int(i) for i in input().split()]

if sum(A)>N:
    print(-1)
else:
    print(sum(A)-N)

Failing test case input:
314 25
9 24 5 8 5 26 19 3 23 8 20 4 2 43 0

Expected output:
115


Actual output:
-115


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
A = [int(i) for i in input().split()]

if sum(A)>N:
    print(-1)
else:
    print(N-sum(A))

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = sum(c)
print(a-d if a >= 0 else "-1")

Failing test case input:
0 2
2 14

Expected output:
-1


Actual output:
-16


Fixed submission (verdict: Accepted):
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = sum(c)
e = a - d
print(e if e >= 0 else "-1")

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    N, M = map(int, input().split())

    A = [int(i) for i in input().split()]

    total_A = sum(A)

    ans = N - total_A

    if ans > 0:
        print('{}'.format(ans))
    else:
        print('{}'.format(-1))



if __name__ == '__main__':
    main()

Failing test case input:
1 2
0 1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
def main():
    N, M = map(int, input().split())

    A = [int(i) for i in input().split()]

    total_A = sum(A)

    ans = N - total_A

    if ans >= 0:
        print('{}'.format(ans))
    else:
        print('{}'.format(-1))



if __name__ == '__main__':
    main()

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
a = input().split()
b = map(int,input().split())
if (sum(b) > int(a[0])):
    print("-1")
else:
    print(int(a[0]) - sum(b)) 

Failing test case input:
38 2
7 2

Expected output:
29


Actual output:
38


Fixed submission (verdict: Accepted):
import math
a = input().split()
b = map(int,input().split())
c = int(a[0])-sum(b)
if (c < 0):
    print("-1")
else:
    print(c)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input().split(" ")
N = int(s[0])
M = s[1]
s = input().split(" ")
A = []
sum = 0
for w in s:
    A.append(int(w))
    sum += int(w)

if sum >= N:
    print(N - sum)
else:
    print(-1)

Failing test case input:
314 25
9 24 5 7 5 26 19 3 23 8 27 0 1 43 0

Expected output:
114


Actual output:
-1


Fixed submission (verdict: Accepted):
s = input().split(" ")
N = int(s[0])
M = s[1]
s = input().split(" ")
A = []
sum = 0
for w in s:
    A.append(int(w))
    sum += int(w)

if sum <= N:
    print(N - sum)
else:
    print(-1)
Problem: p02706
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))


def main():
    N, M = MI()
    A = LI()
    sumA = sum(A)
    ans = N - sumA
    print(sumA)
    if ans<0:
        print(-1)
    else:
        print(ans)



if __name__ == "__main__":
	main()

Failing test case input:
20 2
19 0

Expected output:
1


Actual output:
19
1


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))


def main():
    N, M = MI()
    A = LI()
    sumA = sum(A)
    ans = N - sumA
    if ans<0:
        print(-1)
    else:
        print(ans)



if __name__ == "__main__":
	main()

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys

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

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

if sum(cur) >= n:
    print(-1)
else:
    print(n - sum(cur))

Failing test case input:
11 2
5 6

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
import sys

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

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

if sum(cur) > n:
    print(-1)
else:
    print(n - sum(cur))

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())
A = map(int, input().split())

print(N-sum(A))


Failing test case input:
28 15
8 23 0 34 5 16 151 1 23 8 46 0 0 70 1

Expected output:
-1


Actual output:
-358


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
A = map(int, input().split())
B = sum(list(A))
print(N-B if N >= B else -1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
t=list(map(int,input().split()))		
s=list(map(int,input().split()))		
 
temp = 0
for i in s:
  temp += i


if(t[0]-temp>=0):
  print(s[0]-temp)
else:
  print(-1)

Failing test case input:
314 25
9 24 5 7 5 26 19 3 23 8 27 1 1 43 0

Expected output:
113


Actual output:
-192


Fixed submission (verdict: Accepted):
t=list(map(int,input().split()))		
s=list(map(int,input().split()))		
 
temp = 0
for i in s:
  temp += i


if(t[0]-temp>=0):
  print(t[0]-temp)
else:
  print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
days = list(input().split())
for i in range(len(days)):
    n -= int(days[i])
print(n)

Failing test case input:
-1 1
2 1

Expected output:
-1


Actual output:
-4


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
a = list(input().split())

for i in range(len(a)):
    n = n - int(a[i])

if n >= 0:
    print(n)
else:
    print(-1)
Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
input=sys.stdin.readline

m,n=map(int,input().split())
A=list(map(int,input().split()))
print(m-sum(A))


Failing test case input:
0 1
3 2

Expected output:
-1


Actual output:
-5


Fixed submission (verdict: Accepted):
import sys
input=sys.stdin.readline

m,n=map(int,input().split())
A=list(map(int,input().split()))
ans=m-sum(A)
if ans<0:
    ans=-1
print(ans)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b = list(map(int, input().strip().split()))
c = list(map(int, input().split()))
print(a - sum(c))

Failing test case input:
3 2
7 8

Expected output:
-1


Actual output:
-12


Fixed submission (verdict: Accepted):
a, b = list(map(int, input().strip().split()))
c = list(map(int, input().split()))
d = a - sum(c)
print(d if d >= 0 else '-1')

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())
A = map(int, input().split())

B = sum(A)

if M < B:
  print(N-B)

else:
  print(-1)

Failing test case input:
253 15
9 24 5 35 8 9 79 3 23 8 46 2 6 43 3

Expected output:
-1


Actual output:
-50


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())

A = [int(i) for i in input().split()]

B = sum(A)

if N >= B:
  print(N-B)

else:
  print('-1')

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m=map(int,input().split())
a=list(map(int,input().split()))
print(n-sum(a) if n-sum(a)<0 else -1)

Failing test case input:
78 2
8 18

Expected output:
52


Actual output:
-1


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
a=sum(list(map(int,input().split())))
if n-a>=0:
    print(n-a)
else:
    print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = input().split()
m = input().split()
n = [int(i) for i in n]
m = [int(i) for i in m]

for i in m:
  n[0]=n[0]-i
  if n[0]<0:
    print("-1")
  else:
    print(n[0])

Failing test case input:
41 2
5 0

Expected output:
36


Actual output:
36
36


Fixed submission (verdict: Accepted):
n = input().split()
m = input().split()
n = [int(i) for i in n]
m = [int(i) for i in m]
a = n[0]
for i in m:
  a -= i
  
if a<0:
  print("-1")
else:
  print(a)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from sys import stdin
N,M = stdin.readline().rstrip().split()
a_list = stdin.readline().rstrip().split()
N,M = int(N),int(M)
for a in a_list:
  N-=int(a)
if(N>0):
  print(N)
print(-1)


Failing test case input:
253 15
9 23 14 4 0 9 19 3 0 8 45 2 3 47 2

Expected output:
65


Actual output:
65
-1


Fixed submission (verdict: Accepted):
from sys import stdin
N,M = stdin.readline().rstrip().split()
a_list = stdin.readline().rstrip().split()
N,M = int(N),int(M)
for a in a_list:
  N-=int(a)
if(N>=0):
  print(N)
else:
	print('-1')
Problem: p02706
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
x,y = map(int,input().split())	
li = list(map(int,input().split()))

for i in [0]*len(li):
  x = x - li[i]

if x < 0 : 
  print(-1)
else:
  print(x)

Failing test case input:
314 25
9 24 5 7 5 26 19 3 23 8 27 1 1 43 0

Expected output:
113


Actual output:
179


Fixed submission (verdict: Accepted):
x,y = map(int,input().split())	
li = list(map(int,input().split()))

for i in li:
  x = x - i

if x < 0 : 
  print(-1)
else:
  print(x)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M = map(int,input().split())
A = list(map(int,input().split()))
x = sum(A)
print(N-x)

Failing test case input:
0 2
2 14

Expected output:
-1


Actual output:
-16


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
A = list(map(int,input().split()))
x = sum(A)
if N-x >= 0:
  print(N-x)
else:
  print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())
A = list(map(int, input().split()))
print(N - sum(A) if N - sum(A) > 0 else 0)

Failing test case input:
253 15
8 23 6 34 5 16 79 3 23 8 46 0 0 70 5

Expected output:
-1


Actual output:
0


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
A = list(map(int, input().split()))
print(N - sum(A) if N - sum(A) >= 0 else -1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    if N - sum(A) > 0:
        return N - sum(A)
    else:
        return -1
print(main())






Failing test case input:
1 2
0 1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    if N - sum(A) >= 0:
        return N - sum(A)
    else:
        return -1
print(main())

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m = (int(x) for x in input().split())
take = list(map(int, input().split()))
for per in take:
    n -= per

if n > 0:
    print(n)
else:
    print('-1')

Failing test case input:
11 2
5 6

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n,m = (int(x) for x in input().split())
take = list(map(int, input().split()))
for per in take:
    n -= per

if n >= 0:
    print(n)
else:
    print('-1')

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int,input().split())
l = list(map(int,input().split()))
su = sum(l) + 1
if N < su:
    print(-1)
else:
    print(N - su)

Failing test case input:
253 15
9 23 8 4 3 9 19 3 8 8 46 2 3 47 2

Expected output:
59


Actual output:
58


Fixed submission (verdict: Accepted):
N, M = map(int,input().split())
l = list(map(int,input().split()))
su = sum(l)
if N < su:
    print('-1')
else:
    print(N - su)
Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M = map(int,input().split())
A = list(map(int,input().split()))

ans = N - sum(A)
if sum(A) < N:
    print(-1)
else:
    print(ans)

Failing test case input:
11 2
5 0

Expected output:
6


Actual output:
-1


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
A = list(map(int,input().split()))

ans = N - sum(A)
if sum(A) > N:
    print(-1)
else:
    print(ans)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M = map(int,input().split())
A = list(map(int,input().split()))
ans = N-sum(A)
if ans <= 0:
  print(-1)
else:
  print(ans)

Failing test case input:
11 2
5 6

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
A = list(map(int,input().split()))
ans = N-sum(A)
if ans < 0:
  print(-1)
else:
  print(ans)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())
A = list(map(int, input().split()))

ans = N - sum(A)

if ans > 0:
  print(ans)
else:
  print(-1)

Failing test case input:
1 2
0 1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
A = list(map(int, input().split()))

ans = N - sum(A)

if ans >= 0:
  print(ans)
else:
  print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)



def in_int():
    return (int(input()))


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


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


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

mod = 7 + 10**9

n, m = in_ints()

a = in_list()

if n > sum(a):
    print(n-sum(a))
else:
    print(-1)

Failing test case input:
11 2
5 6

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)



def in_int():
    return (int(input()))


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


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


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

mod = 7 + 10**9

n, m = in_ints()

a = in_list()

if n >= sum(a):
    print(n-sum(a))
else:
    print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M=map(int,input().split())
A=list(map(int,input().split()))

total=sum(A)
if total<N:
    print(N-total)
else:
    print(-1)

Failing test case input:
1 2
0 1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
A=list(map(int,input().split()))

total=sum(A)
if total<=N:
    print(N-total)
else:
    print(-1)
Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

N, M = map(int, input().split())
As = list(map(int, input().split()))
print(N - sum(As))

Failing test case input:
28 15
8 23 0 34 5 16 151 1 23 8 46 0 0 70 1

Expected output:
-1


Actual output:
-358


Fixed submission (verdict: Accepted):

N, M = map(int, input().split())
As = list(map(int, input().split()))
k = N - sum(As)
if k < 0:
    k = -1
print(k)

Problem: p02706
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n, m = map(int, input().split())

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

if n > sum(l):
  print(n-sum(l))
else:
  print(-1)

Failing test case input:
1 2
0 1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
 
l = list(map(int, input().split()))
 
if n >= sum(l):
  print(n-sum(l))
else:
  print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):




def main():
    n, m = map(int, input().split())
    a_list = map(int, input().split())

    r = n - sum(a_list)
    print(r)


if __name__ == '__main__':
    main()


Failing test case input:
253 15
8 23 6 35 5 16 79 3 23 8 46 0 0 47 3

Expected output:
-1


Actual output:
-49


Fixed submission (verdict: Accepted):




def main():
    n, m = map(int, input().split())
    a_list = map(int, input().split())

    r = n - sum(a_list)
    print(r if r >= 0 else -1)


if __name__ == '__main__':
    main()

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())

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

sum_A = sum(A)

if sum_A > -1:
    print(N-sum_A)
else:
    print(-1)

Failing test case input:
-1 1
5 2

Expected output:
-1


Actual output:
-8


Fixed submission (verdict: Accepted):
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))

if n-sum(a)>-1:
    print(n-sum(a))
else:
    print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    n,m = map(int,input().split())
    a = list(map(int,input().split()))
    s = sum(a)
    if s<m:
        print(-1)
    else:
        print(n-s)


if __name__ == "__main__":
    main()

Failing test case input:
253 15
9 23 5 35 8 9 79 3 23 8 46 2 6 47 3

Expected output:
-1


Actual output:
-53


Fixed submission (verdict: Accepted):
def main():
    n,m = map(int,input().split())
    a = list(map(int,input().split()))
    s = sum(a)
    if s>n:
        print('-1')
    else:
        print(n-s)


if __name__ == "__main__":
    main()

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A,B=map(int,input().split())
Lis=list(map(int,input().split()))

if A>sum(Lis):
    print(A-sum(Lis))

else:
    print(-1)

Failing test case input:
11 2
5 6

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
A,B=map(int,input().split())
Lis=list(map(int,input().split()))

if A>=sum(Lis):
    print(A-sum(Lis))

else:
    print(-1)
Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
k,p = map(int,input().split())
H = list(map(int,input().split()))
kk=sum(H)
if k-kk > 0:
    print(k-kk)
else:
    print(-1)


Failing test case input:
1 2
0 1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
k,p = map(int,input().split())
H = list(map(int,input().split()))
kk=sum(H)
if k-kk >= 0:
    print(k-kk)
else:
    print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M=map(int,input().split())
A=list(map(int,input().split()))

homework=0

for a in A:
    homework+=a

if N>homework:
    print(N-homework)
else:
    print(-1)

Failing test case input:
1 2
0 1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
A=list(map(int,input().split()))

homework=0

for a in A:
    homework+=a

if N>=homework:
    print(N-homework)
else:
    print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
print(a[0]-sum(b))

Failing test case input:
3 2
7 8

Expected output:
-1


Actual output:
-12


Fixed submission (verdict: Accepted):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = a[0]-sum(b)
if c>=0:
  print(c)
else:
  print("-1")

Problem: p02706
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N, M = map(int, input().split())
A = list(map(int, input().split()))
days = 0
for a in A:
    days += a
result = N - days
print(str(result))

Failing test case input:
1 2
7 8

Expected output:
-1


Actual output:
-14


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
A = list(map(int, input().split()))
days = 0
for a in A:
    days += a
result = N - days
if result < 0:
    print("-1")
else:  
    print(str(result))

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
if __name__ == "__main__":
    n, m = map(int, input().split())
    al = list(map(int, input().split()))
    res = sum(al[:m])
    print(n - res)


Failing test case input:
253 15
9 24 5 35 8 9 79 3 23 8 46 2 6 43 3

Expected output:
-1


Actual output:
-50


Fixed submission (verdict: Accepted):
if __name__ == "__main__":
    n, m = map(int, input().split())
    al = list(map(int, input().split()))
    res = sum(al[:m])
    res = n - res
    if res < 0:
        print("-1")
    else:
        print(res)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())
l = list(map(int, input().split()))

sum = 0
for e in l:
    sum += e

x = N - sum
print(x)

Failing test case input:
1 2
7 8

Expected output:
-1


Actual output:
-14


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
l = list(map(int, input().split()))

sum = 0
for e in l:
    sum += e

x = N - sum
if x < 0:
    print(-1)
else:
    print(x)
Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
a = list(map(int, input().split()))

ans = n - sum(a)
if ans > 0:
    print(ans)
else:
    print(-1)



Failing test case input:
1 2
0 1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):


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

ans = n - sum(a)
if ans >= 0:
    print(ans)
else:
    print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
NM = str(input()).split()
work = str(input()).split()
SV = int(NM[0])
for i in range(len(work)):
	SV -= int(work[i])

print(SV)



Failing test case input:
-1 1
2 1

Expected output:
-1


Actual output:
-4


Fixed submission (verdict: Accepted):
NM = str(input()).split()
work = str(input()).split()
SV = int(NM[0])
for i in range(len(work)):

	SV -= int(work[i])
	if SV <= -1:
		SV = -1
		break

print(SV)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
s = sum(a)
print(n - s)


Failing test case input:
0 2
2 14

Expected output:
-1


Actual output:
-16


Fixed submission (verdict: Accepted):
n, m = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
s = sum(a)
if n - s < 0:
    print(-1)
else:
    print(n - s)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

import math

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

a = n-sum(li)
if 0 <= n:
    print(a)
else:
    print(-1)

Failing test case input:
3 2
7 4

Expected output:
-1


Actual output:
-8


Fixed submission (verdict: Accepted):

import math

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

a = n-sum(li)
if 0 <= a:
    print(a)
else:
    print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

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

sm = sum(A)
count = N - sm
print(count)


Failing test case input:
253 15
9 24 5 35 8 9 79 3 23 8 46 2 6 43 3

Expected output:
-1


Actual output:
-50


Fixed submission (verdict: Accepted):

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

sm = sum(A)
count = N - sm
if count < 0:
    print(-1)
else:
    print(count)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M = map(int,input().split())
A = list(map(int,input().split()))

days = 0
for a in A:
    days+=a

print(N-days)

Failing test case input:
0 2
6 8

Expected output:
-1


Actual output:
-14


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
A = list(map(int,input().split()))

days = 0
for a in A:
    days+=a

if N-days>=0:
    print(N-days)
else:
    print(-1)
Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m=map(int,input().split())
A = list(map(int, input().split()))
A = sum(A)
ans = n-A

print(ans)

Failing test case input:
0 2
2 8

Expected output:
-1


Actual output:
-10


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
A = list(map(int, input().split()))
A = sum(A)
ans = n-A
if ans<0:
  ans = -1

print(ans)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


N, M = map(int, input().split())
ans = sum(map(int, input().split()))

if ans >= 0:
    print(N - ans)
else:
    print(-1)

Failing test case input:
253 15
8 23 6 35 5 16 79 3 23 8 46 0 0 47 5

Expected output:
-1


Actual output:
-51


Fixed submission (verdict: Accepted):


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

if N - A >= 0:
    print(N - A)
else:
    print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M = map(int, input().split())
A = list(map(int,input().split()))

if N-sum(A) > 0:
    print(N-sum(A))
else:
    print(-1)

Failing test case input:
11 2
5 6

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
N,M = map(int, input().split())
A = list(map(int,input().split()))

if N-sum(A) >= 0:
    print(N-sum(A))
else:
    print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):










N, M = map(int, input().split())
array = list(map(int, input().strip().split()))
for value in array :
  N -= value
print(N)


Failing test case input:
1 2
7 8

Expected output:
-1


Actual output:
-14


Fixed submission (verdict: Accepted):










N, M = map(int, input().split())
array = list(map(int, input().strip().split()))
for value in array :
  N -= value
if N < 0 :
  N = -1
print(N)

Problem: p02706
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
ip1 = input()
ip1list = ip1.split(" ")
N = int(ip1list[0])
M = int(ip1list[1])
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))

for a in A:
    N -= a
if N<=0:
    print(-1)
else:
    print(N)

Failing test case input:
1 2
0 1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
ip1 = input()
ip1list = ip1.split(" ")
N = int(ip1list[0])
M = int(ip1list[1])
ip2 = input()
A_sub = ip2.split(" ")
A = []
for a in A_sub:A.append(int(a))
r = N-sum(A)
if r < 0:
    print(-1)
else:
    print(r)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = sum(c)
print(a-d)

Failing test case input:
10 3
6 6

Expected output:
-1


Actual output:
-2


Fixed submission (verdict: Accepted):
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = sum(c)
e = a - d
print(e if e >= 0 else "-1")
Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b = map(int, input().split())
s = input()
count = 0
nums = s.rstrip().split(' ')
for num in nums:
  count += int(num)
print(a-count)

Failing test case input:
253 15
8 23 6 35 5 16 79 3 23 8 46 0 0 47 3

Expected output:
-1


Actual output:
-49


Fixed submission (verdict: Accepted):
a,b = map(int, input().split())
s = input()
count = 0
nums = s.rstrip().split(' ')
for num in nums:
  count += int(num)
c = a - count
if c >= 0:
  print(c)
else:
  print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,m=INTM()
    a=LIST()
    print(n-sum(a))
if __name__ == '__main__':
    do()

Failing test case input:
253 15
8 23 6 35 8 16 79 3 23 8 46 0 0 47 3

Expected output:
-1


Actual output:
-52


Fixed submission (verdict: Accepted):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,m=INTM()
    a=LIST()
    print(max(n-sum(a),-1))
if __name__ == '__main__':
    do()

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, y = map(int,input().split())
arr = list(map(int, input().split()[:y]))
s = 0
for i in arr:
    s += i
re = x - s
if re > 0:
    print(re)
else:
    print(-1)

Failing test case input:
11 2
5 6

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
x, y = map(int,input().split())
arr = list(map(int, input().split()[:y]))
s = 0
for i in arr:
    s += i
re = x - s
if s > x:
    print(-1)
elif s == x:
    print(0)
else:
    print(re)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())
A = list(map(int, input().split()))
for Ai in A:
  N -= Ai
  if N < 0:
    print(-1)
if N >= 0:
  print(N)

Failing test case input:
253 15
8 23 6 35 5 16 79 3 23 8 46 0 0 47 5

Expected output:
-1


Actual output:
-1
-1


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
A = list(map(int, input().split()))
for Ai in A:
  N -= Ai
  if N < 0:
    print(-1)
    break
if N >= 0:
  print(N)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m=map(int,input().split())
a = list(map(int,input().split()))
print(n-sum(a))

Failing test case input:
253 15
9 23 5 35 8 9 79 3 23 8 46 2 1 47 3

Expected output:
-1


Actual output:
-48


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
a = list(map(int,input().split()))
x=n-sum(a)
if x<0:
    print(-1)
else:
    print(x)
Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    n, m = map(int, readline().rstrip().split())
    a = list(map(int, readline().rstrip().split()))
    print(n - sum(a) if n - sum(a) > 0 else -1)


if __name__ == '__main__':
    main()


Failing test case input:
1 2
0 1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    n, m = map(int, readline().rstrip().split())
    a = list(map(int, readline().rstrip().split()))
    print(n - sum(a) if n - sum(a) >= 0 else -1)


if __name__ == '__main__':
    main()

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b = map(int,input().split())
c  =[int(i) for  i in input().split()]
su=sum(c)
n = a-su
if n>0:
  print(n)
else:
  print(-1)

Failing test case input:
1 2
0 1

Expected output:
0


Actual output:
-1


Fixed submission (verdict: Accepted):
a,b = map(int,input().split())
c  =[int(i) for  i in input().split()]
su=sum(c)
n = a-su
if n>=0:
  print(n)
else:
  print(-1)

Problem: p02706
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N, M = map(int, input().split())
A = list(map(int, input().split()))

print(N - sum(A))


Failing test case input:
253 15
8 23 6 35 5 16 79 3 23 8 46 0 0 70 5

Expected output:
-1


Actual output:
-74


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
A = list(map(int, input().split()))

if N-sum(A) >= 0:
    print(N - sum(A))
else:
    print("-1")

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from sys import stdin


def get_result(data):
    N, M = data[0]
    A = data[1]
    return N - sum(A)


if __name__ == '__main__':
    raw_data = [val.rstrip() for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)


Failing test case input:
28 15
8 23 0 34 5 16 151 1 23 8 46 0 0 70 1

Expected output:
-1


Actual output:
-358


Fixed submission (verdict: Accepted):
from sys import stdin


def get_result(data):
    N, M = data[0]
    A = data[1]
    ans = N - sum(A)
    if ans < 0:
        return -1
    return ans


if __name__ == '__main__':
    raw_data = [val.rstrip() for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = list(map(int, input().split()))
print(max(n - sum(list(map(int, input().split()))), 0))

Failing test case input:
-1 2
2 1

Expected output:
-1


Actual output:
0


Fixed submission (verdict: Accepted):
n, m = list(map(int, input().split()))
print(max(n - sum(list(map(int, input().split()))), -1))
Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())

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

s = sum(A)

if s > N:
    print(-1)
else:
    print(N - s)
print(-1)

Failing test case input:
253 15
8 23 6 35 8 9 79 3 23 8 46 2 1 47 3

Expected output:
-1


Actual output:
-1
-1


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())

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

s = sum(A)

if s > N:
    print(-1)
else:
    print(N - s)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m = map(int, input().split())
a = [int(i) for i in input().split()]

if sum(a) < n:
    print(n-sum(a))
else:
    print('-1')

Failing test case input:
11 2
5 6

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n,m = map(int, input().split())
a = [int(i) for i in input().split()]

if sum(a) <= n:
    print(n-sum(a))
elif sum(a) > n:
    print('-1')

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input().split()[0])
print(max(0, n - sum(map(int, input().split()))))

Failing test case input:
28 15
8 23 0 34 5 16 151 1 23 8 46 0 0 70 1

Expected output:
-1


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input().split()[0])
print(max(-1, n - sum(map(int, input().split()))))

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,M=map(int,input().strip().split())
A=list(map(int,input().strip().split()))

if sum(A)>41:
    print(-1)
else:
    print(N-sum(A))

Failing test case input:
314 25
9 24 5 7 5 35 19 3 23 8 27 0 1 43 0

Expected output:
105


Actual output:
-1


Fixed submission (verdict: Accepted):
N,M=map(int,input().strip().split())
A=list(map(int,input().strip().split()))

if sum(A)>N:
    print(-1)
else:
    print(N-sum(A))

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())
A = list(map(int, input().split()))

ASOBU = sum(A) - N

if ASOBU >= 0:
    print(ASOBU)
else:
    print('-1')

Failing test case input:
3 2
7 8

Expected output:
-1


Actual output:
12


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
A = list(map(int, input().split()))

ASOBU = N - sum(A)

if ASOBU >= 0:
    print(ASOBU)
else:
    print('-1')

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

def resolve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    print(N - sum(A))

if __name__ == "__main__":
    resolve

Failing test case input:
253 15
8 23 6 35 8 9 79 3 23 8 46 2 1 47 3

Expected output:
-1


Actual output:

Fixed submission (verdict: Accepted):

def resolve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    ans = N - sum(A)
    if ans < 0:
        print(-1)
    else:
        print(ans)


if __name__ == "__main__":
    resolve()
Problem: p02706
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import math
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())
n,m = mi()
a = li()
if (sum(a) - n < 0):
    print("-1")
else:
    print(n - sum(a))

Failing test case input:
0 2
2 14

Expected output:
-1


Actual output:
-16


Fixed submission (verdict: Accepted):
import math
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())
n,m = mi()
a = li()
if (n - sum(a) < 0):
    print("-1")
else:
    print(n - sum(a))

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m=map(int,input().split())
l=list(map(int,input().split()))
print(n-sum(l))

Failing test case input:
253 15
8 23 6 35 8 9 79 3 23 8 46 2 0 47 3

Expected output:
-1


Actual output:
-47


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
l=list(map(int,input().split()))
if n-sum(l)<0:
    print('-1')
else:
    print(n-sum(l))

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def readInt():
    return list(map(int,input().split()))
n, m = readInt()
a = readInt()
ans = n- sum(a)
print(ans)

Failing test case input:
-1 1
5 2

Expected output:
-1


Actual output:
-8


Fixed submission (verdict: Accepted):
def readInt():
    return list(map(int,input().split()))
n, m = readInt()
a = readInt()
ans = n- sum(a)
if ans < 0:
    print(-1)
else:
    print(ans)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
a = [int(i) for i in input().split()]
x = n - sum(a)
print(x) if x else print(-1)

Failing test case input:
10 2
6 6

Expected output:
-1


Actual output:
-2


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
a = [int(i) for i in input().split()]
x = n - sum(a)
print(x) if x>=0 else print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
a = map(int, input().split())

check = n - sum(list(a))
if check > 0:
    print(check)
else:
    print(-1)

Failing test case input:
11 2
5 6

Expected output:
0

Actual output:
-1


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
a = map(int, input().split())

check = n - sum(list(a))
if check >= 0:
    print(check)
else:
    print(-1)

Problem: p02706
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = map(int, input().split())
A = list(map(int, input().split()))
ans = sum(A) if N > sum(A) else 'No'
print(ans)

Failing test case input:
253 15
9 23 14 4 0 9 19 3 0 8 45 2 3 47 2

Expected output:
65


Actual output:
188


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
A = list(map(int, input().split()))
ans = N - sum(A) if N >= sum(A) else -1
print(ans)