qyliang/CodeNanoFix huggingface dataset:
Buggy code:
a,b=map(int,input().split())

c=[i for i in input().split()]

print(a-sum(c) if a>=sum(c) else '-1')

Fixed code:
a,b=map(int,input().split())
 
c=[int(i) for i in input().split()]
d=sum(c)
print(a-sum(c) if a>=sum(c) else '-1')
Buggy code:
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()


Fixed code:
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()
Buggy code:
n, m = map(int, input().split())
a = list(map(int, input().split()))

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



Fixed code:
# ABC163B

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

ans = n - sum(a)
if ans >= 0:
    print(ans)
else:
    print(-1)
Buggy code:
n, m = map(int, input().split())

a = sum(list(map(int, input().split())))

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

Fixed code:
n, m = map(int, input().split())

a = sum(list(map(int, input().split())))

if n >= a:
    print(n-a)
else:
    print(-1)
Buggy code:
mn = input().split()
mn = [int(x) for x in mn]
n = mn[0]
m = mn[1]
a = input().split()
a  = [int(x) for x in a]


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

Fixed code:
mn = input().split()
mn = [int(x) for x in mn]
n = mn[0]
m = mn[1]
a = input().split()
a  = [int(x) for x in a]


total = sum(a)
if n-total <0:
    print('-1')
else:
    print(n-total)
Buggy code:
a=input().split()
N=int(a[0])
M=int(a[1])
M_list=input().split()
Flag=True
item_list=[]
for item in M_list :
	item_list.append(int(item))
    
if N<sum(item_list):
	print('-1')
else :
	for item in item_list :
    	N-=item
    print(N)
	

Fixed code:
a=input().split()
N=int(a[0])
M=int(a[1])
M_list=input().split()
Flag=True
item_list=[]
for item in M_list :
	item_list.append(int(item))
    
if N<sum(item_list):
	print('-1')
else :
	for item in item_list :
		N-=item
	print(N)
Buggy code:
n, m = map(int, input().split())
a = list(map(int, input().split()))

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

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

if sum(a) > n:
    print("-1")
else:
    print(n-sum(a))
Buggy code:
N,M =map(int,input().split())
a =list( map(int,input().split()) )
if sum(a)-N >=0:
    print(sum(a)-N)
else :
    print('-1')  

Fixed code:
N,M =map(int,input().split())
a =list( map(int,input().split()) )
if N-sum(a) >=0:
    print(N-sum(a))
else :
    print(-1)
Buggy code:
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)


Fixed code:
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)
Buggy code:
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)

Fixed code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
sum_val = sum(A)
if sum_val <= N:
    print(N - sum_val)
else:
    print(-1)
Buggy code:
N,m = input().split()
M = int(m)
L1 = list(map(int,input().split()))
ans=-1
if sum(L1)<=N:
    ans = N - sum(L1)
print(ans)

Fixed code:
n,m = input().split()
N = int(n)
L1 = list(map(int,input().split()))
ans=-1
if sum(L1)<=N:
    ans = N-sum(L1)
print(ans)
Buggy code:
n, m = map(int, input().split())
a = [i for i in map(int, input().split())]

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

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

if n-sum(a)>=0:
    print(n-sum(a))
else:
    print(-1)
Buggy code:
n = int(input())
m = int(input())
li = list(map(int,input().split()))
if n - sum(li) >= 0:
    print(n - sum(li))
else:
    print(-1)

Fixed code:
n,m = map(int,input().split())
li = list(map(int,input().split()))
if n - sum(li) >= 0:
    print(n - sum(li))
else:
    print(-1)
Buggy code:
n,m = map(int, input().split())
l = list(map(int, input().split()))
if(sum(l)<n):
  print(-1)
else:
  print(n-sum(l))

Fixed code:
n,m = map(int, input().split())
l = list(map(int, input().split()))
if(sum(l)>n):
    print(-1)
else:
    print(n-sum(l))
Buggy code:
n,m = map(int,input().split())
ls = list(map(int,input().split()))
for a in range(ls):
  n -= a
print(max(-1,n))

Fixed code:
n,m = map(int,input().split())
ls = list(map(int,input().split()))
for a in ls:
  n -= a
print(max(-1,n))
Buggy code:
N,M = map(int, input().split())
A = map(int, input().split())
if N >= sum(A):
    print((N)-(sum(A)))
else:
    print("-1")


Fixed code:
N,M = map(int, input().split())
A = map(int, input().split())
Z = sum(A)
if (N) >= (Z):
    print((N)-(Z))
else:
    print("-1")
Buggy code:
if __name__ == '__main__':
    x=list(map(int,input().split(" ")))
    y = list(map(int, input().split(" ")))
    num=0
    for i in y:
        num+=i
    if x[0]<y:
        print(-1)
    else: print(x[0]-y)

Fixed code:
if __name__ == '__main__':
    x=list(map(int,input().split(" ")))
    y = list(map(int, input().split(" ")))
    num=0
    for i in y:
        num+=i
    if x[0]<num:
        print(-1)
    else: print(x[0]-num)
Buggy code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
if sum(a) < n:
    print(n - sum(a))
else:
    print(-1)

Fixed code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
if s <= n:
    print(n-s)
else:
    print(-1)
Buggy code:
n, m = map(int, input().split())
lst = [ int(i) for i in input().split() ]

if n - lst.sum() >= 0:
  print(n-lst.sum())
else:
  print(-1)

Fixed code:
n, m = map(int, input().split())
lst = [ int(i) for i in input().split() ]

if n - sum(lst) >= 0:
  print(n-sum(lst))
else:
  print(-1)
Buggy code:
import numpy as np

A=list(input().split())

print(A, A[0], int(A[0]))

N=int(A[0])
M=int(A[1])

B=list(input().split())

k=0

for i in range(len(B)):
    k+=int(B[i])

print(N-k if N-k>=0 else -1)


Fixed code:
import numpy as np

A=list(input().split())


N=int(A[0])
M=int(A[1])

B=list(input().split())

k=0

for i in range(len(B)):
    k+=int(B[i])

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

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

Fixed code:
m, n = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
print(m - sum(a)) if m - sum(a) >= 0 else print(-1)
Buggy code:
arr = list(map(int, input().split()))
ais = list(map(int, input().split()))

days,tasks = arr[0],arr[1]

def main(days, ais):
  sum = 0
  for i in ais:
    sum += 0
    if sum > days: return -1

  return days - sum

print(main(days, ais))


Fixed code:
arr = list(map(int, input().split()))
ais = list(map(int, input().split()))

days,tasks = arr[0],arr[1]

def main(days, ais):
  sum = 0
  for i in ais:
    sum += i
    if sum > days: return -1

  return days - sum

print(main(days, ais))
Buggy code:
n,m = map(int,input().split())
a_ = list(map(int,input().split()))

sum = sum(s_)
res = n - sum

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


Fixed code:
n,m = map(int,input().split())
a_ = list(map(int,input().split()))

sum = sum(a_)
res = n - sum

if(res < 0):
    print(-1)
else:
    print(res)
Buggy code:
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))

Fixed code:
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))
Buggy code:
N,M = map(int,input().split())
A = list(map(int,input().split()))
if N > sum(A):
  print(N-sum(A))
else:
  print(-1)


Fixed code:
N,M = map(int,input().split())
A = list(map(int,input().split()))
if N >= sum(A):
  print(N-sum(A))
else:
  print(-1)
Buggy code:
N,M=map(int,input().split())
A=list(map(int,input().split()))

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

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

total=sum(A)
if total<=N:
    print(N-total)
else:
    print(-1)
Buggy code:
N, M = map(int, input().split())
A = list(map(int, input().split()))

ASOBU = sum(A) - N

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

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

ASOBU = N - sum(A)

if ASOBU >= 0:
    print(ASOBU)
else:
    print('-1')
Buggy code:
n,m = map(int, input().split())

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

suma = sum(a)

tmp = n - suma

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

Fixed code:
n,m = map(int, input().split())

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

suma = sum(a)

tmp = n - suma

if tmp >= 0:
    print(tmp)
else:
    print(-1)
Buggy code:
def main():
    i = input().split()[0]
    i = int(i)
    ii = input().split()
    ii = [int(x) for x in ii]
    ii = sum(ii)
    if ii > i:
        print(-1)
    else:
        print(ii - i)


main()

Fixed code:
def main():
    i = input().split()[0]
    i = int(i)
    ii = input().split()
    ii = [int(x) for x in ii]
    ii = sum(ii)
    if ii > i:
        print(-1)
    else:
        print(i - ii)


main()
Buggy code:
import math
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom
"""
int(input())
map(int,input().split())
list(map(int,input().split()))
"""


            
       

t=1
for term in range(1,t+1):
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    s=sum(A)
    if(n>s):
        print(n-s)
    else:
        print(-1)

Fixed code:
import math
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom
"""
int(input())
map(int,input().split())
list(map(int,input().split()))
"""


            
       

t=1
for term in range(1,t+1):
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    s=sum(A)
    if(n>=s):
        print(n-s)
    else:
        print(-1)
Buggy code:
n, m = map(int,input().split())
a = list(map(int,input().split()))

total = sum(a)

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

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

total = sum(a)

if (n - total) >= 0:
    print(n - total)
else:
    print('-1')
Buggy code:
def solution():
    return 1

def main():
    N , M = list(map(int , input().split()))
    assignments = list(map(int , input().split()))
    for a in assignments:
        N -= a 
    if N < 0:
        N = 0
    print(N)       
   
if __name__ == "__main__":
    main()


Fixed code:
def solution():
    return 1

def main():
    N , M = list(map(int , input().split()))
    assignments = list(map(int , input().split()))
    for a in assignments:
        N -= a 
    if N < -1:
        N = -1
    print(N)       
   
if __name__ == "__main__":
    main()
Buggy code:
N,M = map(int, input().split())
A = list(map(int, input().split()))

ans = max(N - sum(A))
print(ans)

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

ans = N - sum(A)
print(max(ans,-1))
Buggy code:
import sys

def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())

n, m = ISI()
l=ILI()
if n-sum8(l)<:print(-1)
else:print(n-sum(l))

Fixed code:
import sys

def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())

n, m = ISI()
l=ILI()
if n-sum(l)<0:print(-1)
else:print(n-sum(l))
Buggy code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
if n-sum(a)<=0:
  print(-1)
else:
  print(n-sum(a))
  
  

Fixed code:
n,m=map(int,input().split())
l=list(map(int,input().split()))
a=sum(l)

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

Fixed code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
print(n-sum(a)) if n-sum(a)>=0 else print(-1)
Buggy code:
a=list(map(int,input().split()))
b=list(map(int,input().split()))
if sum(b)>a[0]:
  print(-1)
elif sum(b)==a[0]:
  print(1)
else:
  print(a[0]-sum(b))

Fixed code:
a=list(map(int,input().split()))
b=list(map(int,input().split()))
if sum(b)>a[0]:
  print(-1)
elif sum(b)==a[0]:
  print(0)
else:
  print(a[0]-sum(b))
Buggy code:
N, M = map(int, input().split())
A = list(map(int, input().split()))

s = 0
for n in A:
	s += n
    
d = N - s

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

Fixed code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
 
s = 0
for n in A:
	s += n
    
d = N - s
 
if d >= 0:
  print(d)
else:
  print(-1)
Buggy code:
#ABC163B
n,m = map(int,input().split())
a = list(map(int,inout().split()))
print(-1 if sum(a) >= n else n-sum(a))

Fixed code:
#ABC163B
n,m = map(int,input().split())
a = list(map(int,input().split()))
print(-1 if sum(a) > n else n-sum(a))
Buggy code:
n,m = list(map(int, input().split()))
a =  list(map(int, input().split()))

print(max(n - sum(a), -1)

Fixed code:
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
 
print(max(n - sum(a), -1))
Buggy code:
n, m = map(int, input().split())
a = list(i for i in input().suplt)

all_homework_day = sum(a)

if all_homework_day <= n:
    play_day = all_homework_day
else:
    play_day = -1

print(play_day)

Fixed code:
n, m = map(int, input().split())
a = list(int(i) for i in input().split())

all_homework_day = sum(a)

if all_homework_day <= n:
    play_day = n - all_homework_day
else:
    play_day = -1

print(play_day)
Buggy code:
N, M = map(int, input().split())
print(max(N - sum([int(x) for x in input.split()]), -1))

Fixed code:
N, M = map(int, input().split())
print(max(N - sum([int(x) for x in input().split()]), -1))
Buggy code:
N, M = int(input())
A = list(map(int, input().split()))
S = sum(A)
ans = -1
if N >= S:
  ans = N-S
print (ans)
  

Fixed code:
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
S = sum(A)
ans = -1
if N >= S:
  ans = N-S
print (ans)
Buggy code:
n, m = map(int, input().split())
a = map(int, input().split())
c = 0
for b in a:
    c += b
if n - c <= 0:
    print(-1)
else:
    print(n-c)


Fixed code:
n, m = map(int, input().split())
a = map(int, input().split())
c = 0
for b in a:
    c += b
if n - c < 0:
    print(-1)
else:
    print(n-c)
Buggy code:
a = int(input())
b = int(input())
c = list(map(int,input().split()))
d = sum(c)

if (a-d) < 0:
    print(-1)
else:
    print(a-d)



    


Fixed code:
a,b = (map(int,input().split()))
c = list(map(int,input().split()))
d = sum(c)

if (a-d) < 0:
    print(-1)
else:
    print(a-d)
Buggy code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
x=sum(a)
if n>x:
  print(n-x)
else:
  print(-1)

Fixed code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
x=sum(a)
if n>=x:
  print(n-x)
else:
  print(-1)
Buggy code:
n, m = map(int, input.split())
a = list(map(int, input.split()))
sum = 0
for i in a:
    sum += i
if n >= sum:
    print(n - sum)
else:
    print(-1)

Fixed code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
sum = 0
for i in a:
    sum += i
if n >= sum:
    print(n - sum)
else:
    print(-1)
Buggy code:
N, M = map(int, input().split())
A = list(map(int, input().split())

s = sum(A)

print( max(N - A, -1) )

Fixed code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
 
s = sum(A)
 
print( max(N - s, -1) )
Buggy code:
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)

Fixed code:
N, M = map(int, input().split())

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

s = sum(A)

if s > N:
    print(-1)
else:
    print(N - s)
Buggy code:
N, M = [int(s) for s in input().split(' ')]
A = [int(s) for s in input().split(' ')]

task_days = sum(A)

if N < task_days:
    return -1
else:
    return N - task_days

Fixed code:
N, M = [int(s) for s in input().split(' ')]
A = [int(s) for s in input().split(' ')]

task_days = sum(A)

if N < task_days:
    print(-1)
else:
    print(N - task_days)
Buggy code:
if __name__ == '__main__':
    N, M = [int(x) for x in input().split()]
    arr = [int(x) for x in input().split()]
    res = N - sum(arr)
    if res < 0:
        print(-1)
    else:


Fixed code:
if __name__ == '__main__':
    N, M = [int(x) for x in input().split()]
    arr = [int(x) for x in input().split()]
    res = N - sum(arr)
    if res < 0:
        print(-1)
    else:
        print(res)
Buggy code:
n, m = input().split()
n = int(n)

a = input().split()
for i in range(len(a)):
	a[i] = int(a[i])
	
if n > sum(a):
	print(n-sum(a))
else:
	print("-1")

Fixed code:
n, m = input().split()
n = int(n)

a = input().split()
for i in range(len(a)):
	a[i] = int(a[i])
	
if n >= sum(a):
	print(n-sum(a))
else:
	print(-1)
Buggy code:
N,M = map(int,input().splti())
homeworks = [int(i) for i in input().splti()]
print(-1 if sum(homeworks) > N else sum(homeworks) - N))

Fixed code:
N,M = map(int,input().split())
homeworks = [int(i) for i in input().split()]
print(-1 if sum(homeworks) > N else N - sum(homeworks))
Buggy code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
if (sum(a) < n):
    print(n-sum(a))
else:
    print(-1)

Fixed code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
if (sum(a) <= n):
    print(n-sum(a))
else:
    print(-1)
Buggy code:
def days():
  n, m = map(int, input().split())
  days = list(map(int, input().split()))
  days = sum(days)
  if n - days > 0:
    return n - days
  else:
    return -1
result = days()
print(result)

Fixed code:
def days():
  n, m = map(int, input().split())
  days = list(map(int, input().split()))
  days = sum(days)
  if n - days >= 0:
    return n - days
  else:
    return -1
result = days()
print(result)
Buggy code:
N, M = map(int, input().split())
A = sum(list(map(int, input().split())))
if A >= M:
    print(A-M)
else:
    print(-1)


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

result = N - sum(A)
if result>=0:
    print(result)
else:
    print(-1)
Buggy code:
def solve():
  n, m = map(int, input().split())
  a = list(map(int, input().split()))
  print(max(0, n-sum(a)))
  return 0
 
if __name__ == "__main__":
  solve()


Fixed code:
def solve():
  n, m = map(int, input().split())
  a = list(map(int, input().split()))
  hoge = max(-1, n-sum(a))
  print(hoge)
  return 0
 
if __name__ == "__main__":
  solve()
Buggy code:
import math

S =  list(map(int,input().split()))
N = S[0]
M = S[1]
A =  list(map(int,input().split()))
ans = N-sum(A)
if ans <= 0:
    ans = -1
    
print(ans)

Fixed code:
import math

S =  list(map(int,input().split()))
N = S[0]
M = S[1]
A =  list(map(int,input().split()))
ans = N-sum(A)
if ans < 0:
    ans = -1
    
print(ans)
Buggy code:
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

n, m = getList()
nums = getList()
sn = sum(nums)
if sn > n:
  print(-1)
else:
  print(n - sn)
  

Fixed code:

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]
 
n, m = getList()
nums = getList()
sn = sum(nums)
if sn > n:
  print(-1)
else:
  print(n - sn)
Buggy code:
n,m=map(int,input().split())
a=[int(b) for b in input()]
def func(n,a):
    if n< sum(a):return "-1"
    else: 
        return n-sum(a)
print(func(n,a))

Fixed code:
n,m=map(int,input().split())
a=[int(b) for b in input().split()]
def func(n,a):
    if n< sum(a):return "-1"
    else: 
        return n-sum(a)
print(func(n,a))
Buggy code:
M,N = map(int,input().split())
A = list(map(int,input().split()))

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

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

s = sum(A)
if s > N:
    print(-1)
else:
    print(N-s)
Buggy code:
n,m = input().split()
a = [i for i in input.split()]
if sum(a)>n:
    print(-1)
else:
    print(m-sum(a))

Fixed code:
n,m = (int(x) for x in input().split())
a = [int(i) for i in input().split()]
if sum(a)>n:
    print(-1)
else:
    print(n-sum(a))
Buggy code:
N,M = input().split()
N = int(N)
M = int(M)

temp = sum(input().split())

if N - temp > -1:
  print(N - temp)
else:
  print("-1")

Fixed code:
N,M = input().split()
N = int(N)
M = int(M)

temp = sum(list(map(int,input().split())))

if N - temp > -1:
  print(N - temp)
else:
  print("-1")
Buggy code:
N,M = map(int, input().split())
A = list(map(int, input().split()))
N -= sum(A)
if N > 0:
  print(N)
else:
  print(-1)

Fixed code:
N,M = map(int, input().split())
A = list(map(int, input().split()))
N -= sum(A)
if N >= 0:
  print(N)
else:
  print(-1)
Buggy code:
a,b=map(int,input().split)
c=input().split()
l=[]
for i in c:
  l.append(int(i))
if sum(l)>a:
  print(-1,end="")
else:
  print(a-sum(l),end="")
  

Fixed code:
a,b=map(int,input().split())
c=input().split()
l=[]
for i in c:
  l.append(int(i))
if sum(l)>a:
  print(-1,end="")
else:
  print(a-sum(l),end="")
Buggy code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
sum = -314
for i in a:
  sum += a
if sum < 0:
  print(-1)
else:
  print(sum)

Fixed code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
sum = n
for i in a:
  sum -= i
if sum < 0:
  print(-1)
else:
  print(sum)
Buggy code:
n, m = map(int, input().split())
a = input().split() 

a = sum(int(i) for i in a)

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

Fixed code:
n, m = map(int, input().split())
a = input().split() 

a = sum(int(i) for i in a)

asobi = n -a
if asobi >= 0:
  print(asobi)
else:
  print(-1)
Buggy code:
n,m = map(int,input()>split())
homework = list(map(int,input().split()))

if n >= sum(homework):
  print(n-sum(homework))

else:
  print(-1)

Fixed code:
n,m = map(int,input().split())
homework = list(map(int,input().split()))

if n >= sum(homework):
  print(n-sum(homework))

else:
  print(-1)
Buggy code:
n, m = map(int, input())
a = sum([int(i) for i in input().split()])

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

Fixed code:
n, m = map(int, input().split())
a = sum([int(i) for i in input().split()])

print(n-a if n-a>=0 else '-1')
Buggy code:
def main():
  n, m = map(int, input().split())
  l = list(map(int, input(.split())))
  ans = n - sum(l)
  if ans < 0:
      ans = -1
  print(ans)

if __name__ == '__main__':
  main()

Fixed code:
def main():
  n, m = map(int, input().split())
  l = list(map(int, input().split()))
  ans = n - sum(l)
  if ans < 0:
      ans = -1
  print(ans)

if __name__ == '__main__':
  main()
Buggy code:
n,m = map(int,input().split())
A = list(map(int,input(),split()))
a = sum(A)

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

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

p = sum(a)

if n>=p:
  print(n-p)
else:
  print(-1)
Buggy code:
n = int(input().split()[0])
print(max(0, n - sum(map(int, input().split()))))

Fixed code:
n = int(input().split()[0])
print(max(-1, n - sum(map(int, input().split()))))
Buggy code:
# -*- coding: utf-8 -*-

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

ans = n - sum(a)

if ans < 0:
    return -1
else:
    return ans


Fixed code:
# -*- coding: utf-8 -*-

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

ans = n - sum(a)

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