Problem:


Score : 200 points

Problem Statement

Takahashi has N days of summer vacation.

His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.

He cannot do multiple assignments on the same day, or hang out on a day he does an assignment.

What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?

If Takahashi cannot finish all the assignments during the vacation, print -1 instead.

Constraints

1 \leq N \leq 10^6

1 \leq M \leq 10^4

1 \leq A_i \leq 10^4

Input

Input is given from Standard Input in the following format:

N M
A_1 ... A_M

Output

Print the maximum number of days Takahashi can hang out during the vacation, or -1.

Sample Input 1

41 2
5 6

Sample Output 1

30

For example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.

Sample Input 2

10 2
5 6

Sample Output 2

-1

He cannot finish his assignments.

Sample Input 3

11 2
5 6

Sample Output 3

0

He can finish his assignments, but he will have no time to hang out.

Sample Input 4

314 15
9 26 5 35 8 9 79 3 23 8 46 2 6 43 3

Sample Output 4

9



Sample input:
41 2
5 6


Sample output:
30

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
assert len(A) == M
# M個の宿題, それぞれAi日かかる
yasumi = N - sum(A)
if yasumi > 0:
  print(yasumi)
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
def readinput():
    n,m=map(int,input().split())
    a=list(map(int,input().split()))
    return n,m,a

def main(n,m,a):
    days=sum(a)
    if days<n:
        return -1
    else:
        return n-days

if __name__=='__main__':
    n,m,a=readinput()
    ans=main(n,m,a)
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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


m = int(M **2 * 1/2 + M *1/2)

if N > m:
    print(N-m)

else:
    print(-1)

Submission status: Wrong Answer

Solution code:

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


m = int(M **2 * 1/2 + M *1/2)

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

else:
    print(-1)

Submission status: Wrong Answer

Solution code:

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


m = int(M **2 * 1/2 + M *1/2)

if N > m:
    print(N-m)

else:
    print(-1)

Submission status: Wrong Answer

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

for i in range(m):
  ans = a[i]
  
print(n - ans)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
task = []
for i in range(1, M + 1):
    task.append("A_" + str(i))

task = map(int, input().split())
task_total = sum(task)

if task_total <= N:
    print(N - task_total)

Submission status: Wrong Answer

Solution code:

N, M = map(int, input().split())
task = []
for i in range(1, M + 1):
    task.append("A_" + str(i))

task = map(int, input().split())
task_total = sum(task)

if task_total <= N:
    print(N - task_total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans1 = sum(A)
ans2 = N - ans1

if N < ans2:
    print(int("-1"))
else:
    print(ans2)

Submission status: Wrong Answer

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

ans1 = sum(A)
ans2 = N - ans1

if N < ans2:
    print("-1")
else:
    print(ans2)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:

# 高橋君の夏休みはN日間です。夏休みの宿題がM個出されており,i番目の宿題をやるにはAi日間かかります。
# 複数の宿題を同じ日にやることはできず、また、宿題をやる日には遊ぶことができません。
# 夏休み中に全ての宿題を終わらせるとき、最大何日間遊ぶことができますか？
# ただし、夏休み中に全ての宿題を終わらせることができないときは、かわりに -1 を出力してください。


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

# リストにM個の数字を、入力したい
# study_days_list = []
# study_days_list.append(study_days)
# print(study_days_list)

total_study_days = sum(study_days)

answer = (N - total_study_days)

if answer <= 0:
    print(-1)
else:
    print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
days_summer_vacation, amount_homework = map(int, input().split())
a = map(int, input().split())
schedule_hw = list(a)

left_free_days = days_summer_vacation

for i in schedule_hw:
    left_free_days -= i
    if left_free_days == 0:
        print(0)
        break
    if left_free_days < 0:
        print(-1)
        break

if left_free_days > 0:
    print(left_free_days)

Submission status: Wrong Answer

Solution code:
days_summer_vacation, amount_homework = map(int, input().split())
a = map(int, input().split())
schedule_hw = list(a)

left_free_days = days_summer_vacation

for i in schedule_hw:
    left_free_days -= i
    if left_free_days == 0:
        print(0)
        break
    if left_free_days < 0:
        print(-1)
        break

if left_free_days >= 1:
    print(left_free_days)

Submission status: Wrong Answer

Solution code:
day, assignment = map(int, input().split())
assignment_time = map(int, input().split())
if sum(assignment_time) > day:
    print(-1)
else:
    print(day - sum(assignment_time))

Submission status: Wrong Answer

Solution code:
day, assignment = map(int, input().split())
assignment_time = map(int, input().split())
if sum(assignment_time)<0:
    print(-1)
else:
    print(sum(assignment_time))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(map(int,input().split()))
sum = 0

for i in range(M):
    sum += A[i]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
l = list(map(int, input().split()))
for i in l:
    n -= i
if n > 0:
    print(n)
else:
    print('-1')

Submission status: Wrong Answer

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

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

print (N-sum(sumlist))

Submission status: Wrong Answer

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

can_play = N - sum(A_lis)
print(can_play if can_play > 0 else -1)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
A=list(map(int,input().split()))
for i in range(m):
  n-=A[i]
  if n<0:
    print(-1)
    break

print(n)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
for i in range(M):
    N-=A[i]
    if N<0:
        print(-1)
print(N)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
L=list(map(int,input().split()))
if sum(L)<n:
  print(n-sum(L))
else:
  print(-1)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a = map(int,input().split())
print(n-sum(a))

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
a = list(map(int, input().split()))
t = 0

for i in range(len(a)):
    t += a[i]
    if t > n:
        t = -1
        break

t = n - t
print(t)

Submission status: Wrong Answer

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

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

for i in a:
    cnt+=i
   
if cnt<0:
    print(-1)

else:
    if cnt%1!=0:
        print(((n-cnt)//1)+1)
    else:
        print(n-cnt)

Submission status: Wrong Answer

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

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

for i in a:
    cnt+=i
   
if cnt<0:
    print(-1)
else:
    if cnt%1!=0:
        print(n-cnt//1+1)
    else:
        print(n-cnt)

Submission status: Wrong Answer

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

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

for i in a:
    cnt+=i
   
if cnt<0:
    print(-1)
else:
    print(n-cnt)

Submission status: Wrong Answer

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

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

for i in range(m):
    cnt+=a[i]
   

if cnt<0:
    print("-1")
else:
    print(n-cnt)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(m):
    n = n - a[i]
print(n)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
x = 0
for i in range(m):
    x = x + a[i]
print(n - x)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
x = 0
for i in range(m):
    x = x + a[i]
print(int(n - x))

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
a = list(map(int, input().split()))
syukudai = 0

for i in range(m):
    syukudai += a[i]
    if syukudai < 0:
        print(-1)
        break
else:
    print(n-syukudai)

Submission status: Wrong Answer

Solution code:
n,_,*a=map(int,input().split())
print(max(-1,n-sum(a)))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
day, cnt = map(int, input().split())
homework = list(map(int,input().split()))

for i in homework:
    day -= i
    
    if day < 0:
        print(-1)
        break
print(day)

Submission status: Wrong Answer

Solution code:
#In[]:
day, cnt = map(int, input().split())
homework = list(map(int,input().split()))

for i in homework:
    if day < 0:
        print(-1)
        break
    day -= i
print(day)

Submission status: Wrong Answer

Solution code:
day, cnt = map(int, input().split())
homework = list(map(int,input().split()))

for i in homework:
    if day <= 0:
        print(-1)
        break
    day -= i
print(day)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
c=list(map(int,input().split()))
print(a-sum(c))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n,m = inpm()
a = inpl()

print(n - np.sum(a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
N, M= map(int, input().split())
A = list(map(int, input().split()))
for j in range(M):
    if N >= 0:
        N = N - A[j]
    else:
        print(-1)
        sys.exit()
print(N)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
print(N - sum(A))

Submission status: Wrong Answer

Solution code:
#import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
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)

main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
for v in a:
    n = n - v
    if n <= 0:
        n = -1
        break
print(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
a, b = list(map(int, input().split()))
s = np.sum(list(map(int, input().split())))
print(np.max(a-s, -1))

Submission status: Wrong Answer

Solution code:
N,_ = map(int, input().split())
z = N - eval(input().replace(*' +'))
print(z if 0<=0 else -1 )

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
l=list(map(int,input().split()))
total=0
for k in range(len(l)):
  total+=l[k]
if total<N:
  print(N-total)
else:
  print("-1")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
print(N-sum(A))

Submission status: Wrong Answer

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

print(n-sum(a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
import numpy as np

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

arr = np.array(lists)
days = arr.sum()

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print(N-A)

Submission status: Wrong Answer

Solution code:
# N: 夏休みの日数，M: 宿題の数
N, M = list(map(int, input().split()))
# i番目の宿題にかかる日数
A = list(map(int, input().split()))

free_days = N - sum(A)

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

Submission status: Wrong Answer

Solution code:
# N: 夏休みの日数，M: 宿題の数
N, M = list(map(int, input().split()))
# i番目の宿題にかかる日数
A = list(map(int, input().split()))

free_days = N - sum(A)

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N, M = MI()
    A = LI()

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

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(M):
    N -= A[i]

print(N if N > 0 else -1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
n, m, *a = map(int, open(0).read().split())
d = n - sum(a)
print(d or "-1"* (d < 0))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
n, m, *a = map(int, open(0).read().split())
d = n - sum(a)
print(d or -1 * (d < 0))

Submission status: Wrong Answer

Solution code:
import numpy as np
N,M=map(int ,input().split())
A=input().split()

s=0
for i in range(M):
  s+=int(A[i])

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

Submission status: Wrong Answer

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

s=0
for i in range(M):
  s+=int(A[i])

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
k=input()

list_a=k.split()

n=list_a[0]

int(n)

m=list_a[1]

int(m)

t=input()

list_b=t.split()

h=len(list_b)

int(h)

list_s=[int(s) for s in list_b]

if m==h and sum(list_s) <= n:
  print(n-sum(list_s))
elif m==h and sum(list_s) > n:
  print("-1")

Submission status: Wrong Answer

Solution code:
k=input()

list_a=k.split()

n=list_a[0]

int(n)

m=list_a[1]

int(m)

t=input()

list_b=t.split()

h=len(list_b)

list_s=[int(s) for s in list_b]

if m==h and sum(list_s)>=n:
  print(sum(list_s)-n)
elif m==h and sum(list_s)<n:
  print("-1")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a = map(int,input().split())
s = 0
for i in a:
  s += i
print(n-s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input().split()[0])
print(max(0, n - sum(map(int, input().split()))))

Submission status: Wrong Answer

Solution code:
#inport
import sys
import numpy as np

#input
N,M = [int(x) for x in sys.stdin.readline().split()]
A = [list(map(int, sys.stdin.readline().split()))]

A = np.array(A)
d = np.sum(A)        

#shori
##初期化

print(N-d)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
A = list(map(int, input().split()))

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline


def inp():
    return(int(input()))


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


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


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


def foo():
    n, m = invr()
    ar = inlt()
    x = sum(ar)
    print(n - x) if n > x else print(-1)


if __name__ == '__main__':
    # t = inp()
    # for i in range(t):
    foo()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
task=list(map(int,input().split()))
print(N-sum(task))

Submission status: Wrong Answer

Solution code:
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)

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
def actual(n, m, a_list):
    return n - sum(a_list)


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

print(actual(n, m, a_list))

Submission status: Wrong Answer

Solution code:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a[0] == sum(b):
  print(-1)
else:
  print(a[0] - sum(b))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
print(n - sum(list(map(int, input().split()))))

Submission status: Wrong Answer

Solution code:
import numpy as np
N,M=map(int,input().split())
p=list(map(int,input().split()))
if np.sum(p)>M:
  print(-1)
else:
  print(N-np.sum(p))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
L=list(map(int,input().split()))
print(N-sum(L))

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
c = sum(map(int, input().split()))

print(max([c - a, -1]))

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
c = sum(map(int, input().split()))

print(max(c - a, -1))

Submission status: Wrong Answer

Solution code:
N,M = [int(i) for i in input().split(" ")]
A = [int(i) for i in input().split(" ")]

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

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

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

print("{}".format(N - sum(A)))

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = list(map(int,input().split()))
#print(A[0])

for i in range(M):
    N -= A[i]

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

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
grid = []
a = list(map(int, input().strip().split()))

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int, input().split())
a=list(map(int, input().split()))
for x in range(len(a)):
    n-=a[x]
if n<0:
    k='-1'
print(n)

Submission status: Wrong Answer

Solution code:
n,m=map(int, input().split())
a=list(map(int, input().split()))
for x in range(len(a)):
    n-=a[x]
if n<0:
    k=-1
print(n)

Submission status: Wrong Answer

Solution code:
n,m=map(int, input().split())
su=0
a=list(map(int, input().split()))
for x in range(m):
    n-=a[x]
if n<0:
    k=-1
print(n)

Submission status: Wrong Answer

Solution code:
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
c=sum(b)

if(c > a[0]):
    print(-1)
else:
    print(c - a[0])

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split(" "))
a=list(map(int,input().split(" ")))
print(min(-1, n-sum(a)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x = list(map(int,input().split()))
y = list(map(int,input().split()))
z = 0
for i in range(x[1]):
    z = z + y[i]
a = x[0] - z
print(a)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = list(map(int,input().split()))
print(N-sum(A))

Submission status: Wrong Answer

Solution code:
n,m = (int(x) for x in input().split())
a = (int(x) for x in input().split())
for node in a:
	n = n - node
print(n if n > 0 else -1)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
n = list(map(int,input().split()))
asobi = N - sum(n) 
print(asobi)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

n, m = ISI()
l=ILI()
print(n-sum(l))

Submission status: Wrong Answer

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

n, m = ISI()
l=ILI()
print(n-sum(l))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
L=list(map(int,input().split()))
day=0
flg=True

for i in range(m):
    day+=L[i]
    if day>=n:
        flg=False
        break

if flg:
    print(n-day)
else:
    print("-1")

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = sum([int(x) for x in input().split()])
if N - M < 0:
  print(-1)
else:
  print(N-M)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
l = list(map(int, input().split()))

res = N - sum(l)
print(res if res>0 else -1)

Submission status: Wrong Answer

Solution code:
D, n = map(int,input().split())
l = list(map(int,input().split()))
print(D-sum(l))

Submission status: Wrong Answer

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

a=[0 for i in range(m)]
a =list(map(int,input().split()))
A=0
for i in range(m):
    A=A+a[i]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=list(map(int,input().split()))
print(n-sum(l))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def resolve():
    a,b = map(int, input().split())
    A = list(map(int, input().split()))
    count = 0

    for c in range(b):
        count += A[c]
    
    print(a - count)
    
resolve()

Submission status: Wrong Answer

Solution code:
a,b  = list(map(int,input().split()))
print(a - sum(list(map(int,input().split()))))

Submission status: Wrong Answer

Solution code:
n, m = input().split()
a = input().split()

a = [int(i) for i in a]
if int(n) >= sum(a):
    print(int(n)-sum(a))
else:
    print(0)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(0,m-1):
    n-=a[i]
if n<=0:
    print(-1)
else:
    print(n)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(0,m):
    n-=a[i]
if n<=0:
    print(-1)
else:
    print(n)