qyliang/CodeNanoFix huggingface dataset:
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:
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:
n,m = input().split()
add = 0
n = int(n)

m = int(m)

for i in range(m):
  lst = list(map(int,input().split()))
for i in lst:
  add += i
if add>n :
  print(-1)
elif(add = n):
  print(0)
else:
  print(n-add)

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

Fixed code:
n,m=map(int,input().split())
a=[int(x) for x 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())
         
print(max(-1, N-sum(A)))

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

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


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


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

print( max( -1,sum( list(map(int,input().split() ) ) ) ) )

Fixed code:
n,m=map(int,input().split())
A=list(map(int,input().split()))
print(max(-1,n-sum(A)))
Buggy code:

def main():
    nm = list(map(int, input().split()))
    a = list(map(int, input().split()))
    aa = nm[0] - sum(a)
    print(aa) if aa < 0 else print(-1)

if __name__ == '__main__':
    main()


Fixed code:

def main():
    nm = list(map(int, input().split()))
    a = list(map(int, input().split()))
    aa = nm[0] - sum(a)
    aa = aa if aa >= 0 else -1
    print(aa)

if __name__ == '__main__':
    main()
Buggy code:
n,m=(int(i) for i in input().split())
l=[int(i) for i in input().split()]
if(sum(l)>=n):
	print(n-sum(l))
else:
	print(-1

Fixed code:
n,m=(int(i) for i in input().split())
l=[int(i) for i in input().split()]
if(sum(l)<=n):
	print(n-sum(l))
else:
	print(-1)
Buggy code:
def actual(n, m, a_list):
    a_sum = sum(a_list)

    if n >= a_sum:
        return n - a_sum

    return -1

N, M = map(int, input().split())
a_list = map(int, input().split())

print(actual(n, m, a_list))

Fixed code:
def actual(n, m, a_list):
    a_sum = sum(a_list)

    if n >= a_sum:
        return n - a_sum

    return -1

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

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

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:
n,m=map(int,input().split())
a = list(map(int,input().split()))
if n<=sum(a):
    print(-1)
    exit()
print(n-sum(a))


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

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

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

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


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

play_days = copy.copy(N)
for i in A:
  play_days -= i
if play_days < 0:
  print(-1)
else:
  print(play_days)

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

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

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

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

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

sum = 0

for i in a:
  sum += i
 
if sum >= n:
  print(-1)
else:
  print(n - sum)

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

sum = 0

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

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

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


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

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

r = n-sum(a_list)
print(r if r >= 0 else -1)
Buggy code:
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()

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

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:
n,m=map(int,input().split())
L=list(map(int,input().split()))
if sum(L)<n:
  print(n-sum(L))
else:
  print(-1)

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

Fixed code:
N, M = map(int, input().split())
list = list(map(int, input().split()))
 
m=0
for i in range (0, len(list)):
	m=m+list[i]
if N-m>=0:
	print(N-m)
elif N-m<0:
	print(-1)
Buggy code:
# abc136

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

ans = n - sum(days)
if ans < 0:
    ans = 0
print(ans)

Fixed code:
# abc136

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

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

for i in list:
    sum += i

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

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

for i in list:
    sum += i

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

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

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

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

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

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

Fixed code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
C = N - sum(A)
if C < 0:
    print(-1)
else:
    print(C)
Buggy code:
x,y = map(int, input().spilit())
array = list(map(int, input().spilit()))
su = sum(array)
a = x - su
if a > -1:
  print(a)
else:
  print(-1)

Fixed code:
x, y = map(int, input().split())
array = list(map(int, input().split()))
su = sum(array)
a = x - su
if a > -1:
    print(a)
else:
    print(-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:
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:
n,m =map(int,input().split())
a =list(map(int,input().split()))

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

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

homework = sum(a)

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

else:
    print(N - homework)

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

homework = sum(a)

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

else:
    print(N - homework)
Buggy code:
n,m = map(int,input())
a = [int(x) for x in input().split()]
s = sum(a)
if n < s:
  print("-1")
else:
  print(n-s)

Fixed code:
n,m = map(int,input().split())
a = [int(x) for x in input().split()]
s = sum(a)
if n < s:
  print("-1")
else:
  print(n-s)
Buggy code:
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)


Fixed code:
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')
Buggy code:
n, m = map(int, input().split())
l=list(map(int, input().split()))
ans= n-sum(l)
if ans>0:
  print(ans)
else:
  print(-1)

Fixed code:
n, m = map(int, input().split())
l=list(map(int, input().split()))
ans= n-sum(l)
if ans>=0:
  print(ans)
else:
  print(-1)
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 sum(a) > n:
         print(-1)
else:
         print(n - (sum(a)))
Buggy code:
s = [input() for i in range(2)] 
li1 = list(map(int, s[0].split()))
li2 = list(map(int, s[1].split()))
k=0;
for j in li2:
    k+=j
    print(k)
if li1[0] > k or li1[0] == k:
    print(li1[0]-k)
else:
    print('-1')

Fixed code:
s = [input() for i in range(2)] 
li1 = list(map(int, s[0].split()))
li2 = list(map(int, s[1].split()))
k=0;
for j in li2:
    k+=j
if li1[0] > k or li1[0] == k:
    print(li1[0]-k)
else:
    print('-1')
Buggy code:
N,M=map(int,input().split())
A=list(map(int,input().split()))

homework=0

for a in A:
    homework+=a

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

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

ex = []
N, M = map(int, input().split())
ex = [exi for exi in map(int, input().split())]

rem = N - sum(ex)
print(rem) if rem > 0 else print('-1')




Fixed code:
import math

ex = []
N, M = map(int, input().split())
ex = [exi for exi in map(int, input().split())]

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

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



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

benkyou = sum(A)

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

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

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

s = sum(A)

ans = N - s

if ans < 0:
    print(-1)
else:
    print(ans)
Buggy code:
N, M = tuple(int(c) for c in input().split(' '))
A = tuple(int(c) for c in input().split(' '))
if len(sum(A)) > N:
  print(-1)
else:
  print(len(sum(A)) > N)

Fixed code:
N, M = tuple(int(c) for c in input().split(' '))
A = tuple(int(c) for c in 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()))
s=sum(a)

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

Fixed code:
m, n = map(int, input().split())
a = sum(map(int, input().split()))
if m-a >= 0:
    print(m-a)
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:
all_days, hw_num = map(int, input().split())
hw_days = []
work = 0

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

for hw_day in hw_days:
    work += hw_day

if (all_days-work)>0:
    print(all_days-work)
else:
    print('-1')

Fixed code:
all_days, hw_num = map(int, input().split())
work = 0

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

for hw_day in hw_days:
    work += hw_day

if (all_days-work)>=0:
    print(all_days-work)
else:
    print('-1')
Buggy code:
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])

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

Fixed code:
N, M = map(int,input().split())
l = list(map(int,input().split()))
su = sum(l)
if N < su:
    print('-1')
else:
    print(N - su)
Buggy code:
n, m = map(int, input().split())
a = list(map(int, input.split()))
s = sum(a)
if n < s:
  print(-1)
else:
  print(n - a)

Fixed code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
if n < s:
  print(-1)
else:
  print(n - s)
Buggy code:
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())
#if main():
#    print('Yes')
#else:
#    print('No')


Fixed code:
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())
#if main():
#    print('Yes')
#else:
#    print('No')
Buggy code:
n, m = input().split()
a = list(map(int, input().split()))
print(max(n-sum(a),-1))

Fixed code:
n,m = map(int, input().split())
a = sum(list(map(int, input().split())))
print(max(-1,n-a))
Buggy code:
N,M = map(int,input().split())
homework = list(map(int,input().split()))

hell = sum(homework)

if N - hell >0:
    print(N - hell)
else:
    print(-1)

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

hell = sum(homework)

if N - hell >=0:
    print(N - hell)
else:
    print(-1)
Buggy code:
N = map(int, input().split())[0]
A = map(int, input().split())
sum = 0
for i in A:
  sum += A
if sum > N:
  print(-1)
else:
  print(N-sum)

Fixed code:
N = list(map(int, input().split()))[0]
A = list(map(int, input().split()))

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

Fixed code:
n, m = map(int, input().split())
A = list(map(int, input().split()))
cnt = sum(A)
if n >= cnt:
  print(n-cnt)
else:
  print('-1')
Buggy code:
import math
n,m=map(int,input().split())
arr=list(map(int,input().split()))
if sum(arr)<n:
    print(-1)
else:
    print(n-sum(arr))

Fixed code:
import math
n,m=map(int,input().split())
arr=list(map(int,input().split()))
if sum(arr)>n:
    print(-1)
else:
    print(n-sum(arr))
Buggy code:
d,h=map(int,input().split())
da=list(map(int,input().split()))
ans = d - sum(da)
if ans > 0:print(ans)
else:print(-1)

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

S =sum(A)

if S-N >=0:
  print(S-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:
n, m = map(int, input().split())
works = list(map(int, input().split()))

print(works)
plays = n - sum(works)
print(plays if plays >= 0 else -1)

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

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

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

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

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

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

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

sumA = sum(As)

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

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

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

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


Fixed code:
n, m=map(int, input().split())
a = list(map(int, input().split()))
ans =  n - sum(a)
if 0 <= ans:
    print(ans)
else:
    print('-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:
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()

Fixed code:
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()
Buggy code:
N, M = map(int, input().split())
days = list(map(int, input().split()))
hw_day = 0
for day in days:
    hw_day += day
if N > hw_day:
    print(N - hw_day)
else:
    print('-1')

Fixed code:
N, M = map(int, input().split())
days = list(map(int, input().split()))
hw_day = 0
for day in days:
    hw_day += day
if N >= hw_day:
    print(N - hw_day)
else:
    print('-1')
Buggy code:
N, M = [int(s) for s in input().split()]
A = [int(a) for a in input().split()]

d = N - sum(A)

if d > 0:
    return d
else:
    return -1

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

d = N - sum(A)

if d >= 0:
    print(d)
else:
    print(-1)
Buggy code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
p=0
for i in a:
  p+=i
if(n>=p):
      print("{}",n-p)
else:
      print("-1")

Fixed code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
p=0
for i in a:
      p+=i
if(n>=p):
          print("{}".format(n-p))
else:
          print("-1")
Buggy code:
n, m = map(int, input().split())
l = sum(map(int, input().split()))
print(n-s if s <= n else -1)

Fixed code:
n, m = map(int, input().split())
s = sum(map(int, input().split()))
print(n-s if s <= n else -1)
Buggy code:
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))

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

day = n - sum(days)
if day > 0:
    print(day)
else:
    print(-1)

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

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

Fixed code:
n,m = map(int, input().split())
an = list(map(int, input().split()))
sum_a = sum(an)
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()))
rest = n - sum(a)
if rest <= 0:
    print(-1)
else:
    print(rest)

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

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

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

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