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: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m = input().strip().split()
n, m = [int(n), int(m)]
grid = []
for i in range(m):
    array = list(map(int, input().strip().split()))
    grid.append(array)
    print(n - sum(array))

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
day_cost = [int(i) for i in input().split()]
holidays = N-sum(day_cost)

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

Submission status: Runtime Error

Solution code:
M, N = map(int ,input().split())
x = [int(x) for x in input().split()]
if 1 <= (N) < 10**6 and 1 <= (M) < 10**4 and 1 <= x[1] < 10**4 :
    if (sum(x)) > M:
        print(-1)
    elif(sum(x) == M):
        print(0)
    elif(sum(x)<M):
        print(M-sum(x))

Submission status: Runtime Error

Solution code:
from operator import add
import functools


n = int(input())
m = int(input())
list_homework = input().split(" ")
list_homework = [int(list_homework[i]) for i in range(len(list_homework))]  

rest_day = n - functools.reduce(add, list_homework)

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

Submission status: Runtime Error

Solution code:
a, b = input(), split()
x = input()

a, b = int()
x = int()

x = a - b * x

if x < 0:
    print('-1')
    
elif x >= 0
    print(x)

Submission status: Runtime Error

Solution code:
N= int(input())
M= int(input())
a = []
for i in range(M):
    n = int(input())
    a=a+[n]
for j in range(M):
    N -= a[j]
if(N < 0):
    N = -1
print(N)

Submission status: Runtime Error

Solution code:
n = int(input())
m = int(input())
l1 = []
for i in range (m):
    ai = int(input())
    l1.append(ai)
s = sum(l1)
r = (n - s)
if r >= 0:
    print(r)
else:
    print("-1")

Submission status: Runtime Error

Solution code:
a, b = input(), split()
x = input()

a, b = int()
x = int()

x = a - b * x

if x < 0:
    print('-1')
    
    elif x >= 0
        print(x)

Submission status: Runtime Error

Solution code:
from operator import add
import numpy as np
import functools


n = int(input())
m = int(input())
list_homework = input().split(" ")
list_homework = [int(list_homework[i]) for i in range(len(list_homework))]  

rest_day = n - functools.reduce(add, list_homework)

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
m=int(input())
sum=0
for i in range(0,m):
  a=int(input())
  sum=sum+a
if(sum<=n):
  c=n-sum
  print(c)
else:
  print("-1")

Submission status: Runtime Error

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

sum=0
for i in range(M):
	sum=sum+A[i]
if(sum<=N):
	sub=N-sum
    print(sub)
else:
	print("-1")

Submission status: Runtime Error

Solution code:
n = int(input())
m = int(input())
l1 = []
for i in range (m):
    a1 = int(input())
    l1.append(a1)
s = sum(l1)
r = n - s
if r >= 0:
    print(r)
else:
    print("-1")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

w = sum(A)

r = N-w

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

Submission status: Runtime Error

Solution code:
n = int(input())
m = int(input())
l1 = []
for i in range (m):
    a1 = int(input())
    l1.append(a1)
s = sum(l1)
r = n - s
print(r)

Submission status: Runtime Error

Solution code:
N= int(input())
M= int(input())
for i in range(M):
    a=int(input())
    N -= a
if(N < 0):
    N=-1
print(N)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())
M = int(input())
A = np.array(list(map(int, input().split())))
Needed = np.sum(A)
if Needed > N:
    print(-1)
else:
    print(N - Needed)

Submission status: Runtime Error

Solution code:
n = int(input())
m = int(input())
l1 = []
for i in range (m):
    a1 = int(input())
    l1.append(a1)
s = sum(l1)
result = n - s
print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

a = [int(input()) for i in range(M)]

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

Submission status: Runtime Error

Solution code:
N = int(input())
M = int(input())

A = [input()for i in range(M)]

x = N
#残り日数
for j in range(M):
    x = x - int(A[j])
    j += 1

if x < 0 :
    print(-1)

else :
    print(x)

Submission status: Runtime Error

Solution code:
input_line = int(input())
ans = [0] * input_line

inputs = input().split(' ')
inputs = list(map(int, inputs))
for e in inputs:
  for i in range(1, input_line):
    if e == i:
      ans[i] += 1

for i in range(len(ans)):
  print(ans[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
R = int(input(""))
C = 2 * math.pi * R
print(C)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

w = sum(A)

r = N-w

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
M = int(input())
l= []
for i in range(M):
  l= l+ [int(input())]
if (sum(l)<=N):
  a = N-sum(l)
else:
  a=-1
print(a)

Submission status: Runtime Error

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

w = sum(A)

r = N-w

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

Submission status: Runtime Error

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

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

if N < 0:
  print(-1)

else:
  print(N)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a,b=map(int,input().split())
if a+b<n:
    print(n-(a+b))
elif a+b==n:
    print(0)
else:
    print(-1)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
M, N= input().split()
A1, Am = input().split()
if 1 <= int(N) < 10**6 and 1 <= int(M) < 10**4 and 1 <= int(A1) < 10**4 :
    if((int(A1) + int(Am)) <= int(M)):
        print((int(A1)+int(Am))-int(M))
    elif (int(A1) + int(Am)) == int(M):
        print(0)
    elif (int(A1)+int(Am)) > int(M):
        print(-1)

Submission status: Runtime Error

Solution code:
vacationDayCount, homeworkCount = map(int, input().split())
requiredDayList = list(map(int, input.split()))

playableDayCount = vacationDayCount - sum(requiredDayList)

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

Submission status: Runtime Error

Solution code:
a = int().input()

N = a[0]
M = a[1]

b = 0
c = []

while true:
  if b > M:
  	break
  e = input(int())
  c.append(e)
  b += 1

d = 0
  
for i in c:
  d += i

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
A = [int(x) for x in input().split()]
sumA = 0

for i in A:
    sumA = sumA + A[i]

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

Submission status: Runtime Error

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

w = sum(A)

r = N-w

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

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
A = [int(x) * M for x in input().split()]

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
R = int(input())
print(R*2.0*math.pi)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np 
N,M=map(int, input().split())  
A=list(map(int, input().split()) 
suma=np.sum(A)
remain=N-suma       

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
a = 0
for _ in range(m):
  a += int(input())
if a > n: print(-1)
else: print(n-a)

Submission status: Runtime Error

Solution code:
import math
R = int(input(""))
print(R*2.0*math.pi)

Submission status: Runtime Error

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

if (N < M):
	print("-1")
else:
	sum = 0
    for i in range(M-1):
    	sum = sum + A[i]
    if(sum <= N):
    	sub = sum-N
        print(sub)
   	else:
    	print("-1")

Submission status: Runtime Error

Solution code:
N, M = int(input().split())
lst = list(int(input().split()))
add=0
for i in range(len(lst)):
  add+=i
if add>N:
  print('-1')
else:
  print(N-add)

Submission status: Runtime Error

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

A =[]

for i in range(M):
  A.append(int(input().split()))

gokei = int(sum(A))

if N - gokei < 0:
  print('-1')

else:
  print(N - gokei)

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
A = [0] * M
A = [int(x) for x in input().split()]

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

Submission status: Runtime Error

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

ans = 0
for i in range(0,M):
  ans = ans + l[i]
  
if(ans > N):
  print("-1")
else:
  print(N-ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np

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

suma=np.sum(A)
remain=N-suma
       
if remain>=0:
       print(remain)
else:
       print(-1)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
a = list(map(int, input().split()))
for i in range(M+1):
  N -= a[i]
print(N if N>0 else '-1')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split)
lis=list(map(int, input().split()))
s=0
for i in lis:
    s+=i
if N-s<0:
    print("-1")
else:
    print(N-s)

Submission status: Runtime Error

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

A =[]

for i in range(M):
  A.append(input())

gokei = int(sum(A))

if N - gokei < 0:
  print('-1')

else:
  print(N - gokei)

Submission status: Runtime Error

Solution code:
from sys import stdin
 
r = int(stdin.readline().rstrip())
print(r*2*3.1415)

Submission status: Runtime Error

Solution code:
import math
    R = int(input(""))
    print(R*2.0*math.pi)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
A = [int(input().split()) for i in range(M)]
 
if(sum(A) == N):
  print('0')
elif(sum(A) > N):
  print(N - sum(A))
else:
  print('-1')

Submission status: Runtime Error

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

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

if N < 0:
  print("-1")

else:
  print(N)

Submission status: Runtime Error

Solution code:
import java.util.Scanner;
public class Dreamoon{
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		int num = input.nextInt();
		int n  = input.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < arr.length; i++){
			arr[i] = input.nextInt();
		}
		int sum = 0;
		for(int i = 0; i < arr.length;i++){
			sum +=arr[i];
		}
		System.out.println(num - sum);
		
	}
}

Submission status: Runtime Error

Solution 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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
A = [input().split() for i in range(M)]
 
if(sum(A) == N):
  print('0')
elif(sum(A) > N):
  print(N - sum(A))
else:
  print('-1')

Submission status: Runtime Error

Solution code:
N = int(input())
M = int(input())

sum = 0

for i in range(1,M+1):
    sum += int(input())

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=input()
N=int(N)
M=input()
M=int(M)

sum=0
for num in range(M):
	a=input()
	a=int(a)
	sum=sum+a
	
nokori=N-sum	
if nokori>=0:
	print(nokori)
	
else:
	print(-1)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
list_=[]
for i in range(b):
  c=int(input())
  list_.append(c)
d=sum(list_)
print(a-d)

Submission status: Runtime Error

Solution code:
a=input().split()
c=input().split()
date=0

for i in c:
	date += int(i)

if date >= int(a[0]):
	print("-1")
else:
	print(N-date)

Submission status: Runtime Error

Solution code:
import sys

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

A = []
for l in sys.stdin:
    A.append(int(l))
    
need_day = sum(A)
    
if N < need_day:
    print(-1)
else:
    print(N-need_day)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import numpy as np

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

suma=np.sum(A)
remain=N-suma
       
if remain>=0:
       print(remain)
else:
       print('-1')

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
A = [input() for i in range(M)]
 
if(sum(A) == N):
  print('0')
elif(sum(A) > N):
  print(N - sum(A))
else:
  print('-1')

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
#include "bits/stdc++.h"
 
using namespace std;
 
#define sp(x) cout<<setprecision(x);
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define yes "Yes"
#define no "No"
#define divs 1000000007
#define dive 1000000009
#define pi 3.141592653589793238
 
typedef pair<int, int> P;
 
 
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(M);
    int wa=0;
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
        wa+=A[i];
    }
    if(wa>N) cout<<-1<<endl;
    else cout<<N-wa<<endl;
    return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
 
R = int(input())
 
print(2*math.pi*R)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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 sum<=n:
    print(n-Sum)
else:
    print(-1)

Submission status: Runtime Error

Solution code:
import math
R = int(input())
L = math.pi*2*R
print(L)

Submission status: Runtime Error

Solution code:
N = int(input())
M = int(input())

A = 0

for i in range(M):
    A += int(input())

if M < A:
    print(N-A)

else:
    print(-1)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution 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

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
flag = True
 
for i in  A:
N = N - i
if N < 0:
flag = False
break
 
if flag == True:
  print(N)
else:
  print(-1)

Submission status: Runtime Error

Solution code:
N,M = map(int, input().split())
A = [0]*M
for i in range(M):
    A[i] = int(input())
SUM = sum(A)
if SUM>N:
    print(-1)
else:
    print(N-SUM)

Submission status: Runtime Error

Solution code:
N,M = map(int, input().split())
list_1 = list(map(int, input().split()))
 
i=0
sum=0
 
while i<=M:
  sum=sum+list_1[i]
  i=i+1
  
if sum>N:
  print("-1")
  
else:
  print(sum-N)

Submission status: Runtime Error

Solution code:
K,S = list(map(int,input().split()))
A=[int(input()) for _ in range(N)]

for i in range(S):
  K = K - A[i]
  
if K < 0:
  print(-1)
else:
  print(K)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
flag = True
 
for i in  A:
  N = N - i
  if N < 0:
    flag = False
    break
 
if flag == True:
print(N)
else:
print(-1)

Submission status: Runtime Error

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

A_sum = sum(A)
if A_sum > N:
    return -1
else:
    return N - A_sum

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

t = 0

for A in day_list:
    t += A

if N - t < 0: print(-1)
else: print(N - t)

Submission status: Runtime Error

Solution code:
R = int(input())
ensyu = 2 * 3.14 * R
print(ensyu)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

i=0
sum=0

while i<=M:
  sum=sum+list[i]
  i=i+1
  
if sum>N:
  print("-1")
  
else:
  print(sum-N)

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

int main()
{
  fast;
  ll n,m,i,a[10000],sum=0;
  cin>>n>>m;
  for(i=0;i<n;i++)
  {
  	cin>>a[i];
    sum+=a[i];
  }
  
  if(sum<=n)
  	cout<<abs(sum-n)<<endl;
  else
  	cout<<"-1"<<endl;
  
  
  return 0;
}

Submission status: Runtime Error

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

for i in  A:
N = N - i
if N < 0:
flag = False
break

if flag == True:
print(N)
else:
print(-1)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-04-19 21:11:23 +0900
# LastModified: 2020-04-19 21:14:03 +0900
#


import os
import sys
import numpy as np
import pandas as pd


def main():
    n,m=map(int,input().split())
    a = list(map(int,input().split()))
    if n-sum(a)<0:
        print(-1)
        return 

    print(n-sum(a))
    


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
r = int(input())
print(r*2*3.1415926535)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np

n = int(input())
m = int(input())
list_homework = input().split(" ")
list_homework = np.array([int(list_homework[i]) for i in range(len(list_homework))])  

rest_day = n - list_homework.sum()

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split()) 
cnt = 0
for i in range(m):
	cnt = cnt + int(input())

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

Submission status: Runtime Error

Solution code:
import math
print(2*math.pi*int(input()))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
input_line = input().split(' ')
days = input_line[0]
assignments = input_line[1]

input_assign = input().split(' ')

how_many_days = sum(input_assign)

len = days - how_many_days
if len < 0:
  print(-1)
else:
  print(len)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#スペース区切りの整数の入力
N,M = map(int, input().split())
#スペース区切りの整数の入力リスト
A_list = list(map(int, input().split()))

sum_ = 0
for i in range(len(A_list)):
  sum_ = sum + A_list[i]
  
ans = N - sum_

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
n = int(input())
print("{0:.20f}".format(2*n*math.pi))

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
mm=[]
for i in range(m):
    s=int(input())
    mm.append(s)
a=n-sum(mm)
if a>=0:
    print(a)
else: print(-1)

Submission status: Runtime Error

Solution code:
n = int(input())
m = int(input())
for i in range(m):
  temp = int(input())
  n -= temp

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
NM = list(map(int, input().split()))
N = NM[0]
M = NM[1]
Alist = []
for i in range(M):
    Alist.append(int(input()))
daysNeeded = sum(Alist)
if daysNeeded>N:
    print(-1)
else:
    print(M - daysNeeded)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution 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