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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ans = m - sum(a)

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(M):
    i = int(input("i:"))
    N = N - i

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

Submission status: Runtime Error

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

for i in range(M):
    i = int(input("i:"))
    N = N - i

print(N)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
r = list(map(int,input().split()))
a = r[0]
b = r[1]
c = r[2:]




while b > 0:
    a -= c[b]
    b -= 1
    
    if a < 0:
        print('-1')
    
    print(a)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
M = int(input())
b = -1
while M != 0:
    M = M -1
    A = int(input())
    V = N - A

if V >= 0:
    print(V)
else:
    print(b)

Submission status: Runtime Error

Solution code:
import collections

n,m = map(int,raw_input().split(' '))
print n - sum([map(int,raw_input().split(' '))] or [0])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
list = int(input().split())
N = list[0]

list_1 = int(input().split())
M = sum(list_1)

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

Submission status: Runtime Error

Solution code:
list = input().split()
N = int(list[0])

list_1 = input().split()
M = int(sum(list_1))

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

Submission status: Runtime Error

Solution code:
N, M = map(int,input().split())
#M 夏休み期間　M　宿題数
A = list(map(int, input().split()))
A_sum = 0
for i in range(0, n):
    A_sum += A[i]
    # A_sum 宿題全日数
x = N - A_sum
if x < N:
    print("-1")
else:
    print(x)

Submission status: Runtime Error

Solution code:
N, M = map(int,input().split())
#M 夏休み期間　M　宿題数
A = list(map(int, input().split()))
A_sum = 0
for i in range(0, n):
    A_sum += A[i]
    # A_sum 宿題全日数
x = N - A_sum
print(x)

Submission status: Runtime Error

Solution code:
list = input().split()
N = int(list[0])

list_1 = input().split()
M = int(sum(list_1))

print(M-N)

Submission status: Runtime Error

Solution code:
list = input().split()
N = int(list[0])

list_1 = input().split()
M = int(list_1.sum())

print(M)

Submission status: Runtime Error

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

for i in range(n):
    A[i] = input()
    i += 1
    D_sum += A[i]
    x = D - D_sum
print()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
human_num = int(input())

nyu = list(map(int, input().split(" ")))

for i in range(human_num):
    print(nyu.count(i + 1))

Submission status: Runtime Error

Solution code:
// C/C++ キーワード定義ファイル キーワード
// cpp_kw2_keywords.kwd
//
//  Created on: 2015/06/13
//      Author: KeitetsuWorks
// CASE=True

__declspec
__except
__finally
__try
break
case
catch
class
const
const_cast
continue
default
delete
deprecated
dllexport
dllimport
do
dynamic_cast
else
enum
explicit
extern
false
for
friend
goto
if
inline
mutable
naked
namespace
new
noinline
noreturn
nothrow
private
protected
public
register
reinterpret_cast
return
selectany
sizeof
static
static_cast
struct
switch
template
this
thread
throw
true
try
typedef
typeid
typename
union
using
uuid
virtual
volatile
while

Submission status: Runtime Error

Solution code:
N, M = input().split(' ')
homeworks = input().split(' ')

total = homeworks.sum()
lday = N - total
if lday >= 0:
  print(lday)
else:
  print(-1)

Submission status: Runtime Error

Solution code:
N , M = input().split(" ")
tm = 0
for i in range(int(M)):
    i = input()
    tm = tm + int(i)
print(int(N)-tm)

Submission status: Runtime Error

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

l = list()
for i in range(m):
  k = int(input())
  l.append(k)
s = sum(l)

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include<string>
#include<stack>

using namespace std;
typedef long long ll;

int main(){
  int n,m;
  cin>>n>>m;
  ll summer = 0;
  for(int i=0;i<m;i++){
    int el;
    cin>>el;
    summer += el;
  }
  if(summer>n){
    print(-1);
  }
  else{
    print(n-summer);
  }
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
"N,M".split(",")
N=N-M
if =0<N:
   print(N)
else:
   print(-1)

Submission status: Runtime Error

Solution code:
N=int(input())
M=int(input())
N=N-M
if N>0=:
   print(N)
else:
   print(-1)

Submission status: Runtime Error

Solution code:
N=int(input())
M=int(input())
N=N-M
if 0<N:
   print(N)
elif 0==N:
   print(0)
else:
   print(-1)

Submission status: Runtime Error

Solution code:
N=int(input())
M=int(input())
N=N-M
if 0<N:
   print(N)
elif 0=N:
   print(0)
else:
   print(-1)

Submission status: Runtime Error

Solution code:
N=int(input())
M=int(input())
if N>M>:
   print(N-M)
else:
   print(-1)

Submission status: Runtime Error

Solution code:
N=int(input())
M=int(input())
N=N-M
if N>0:
   print(N)
else:
   print(-1)

Submission status: Runtime Error

Solution code:
N=int(input())
M=int(input())
if N>M:
   print(N-M)
else:
   print(-1)

Submission status: Runtime Error

Solution code:
N=int(input())
M=int(input())
if N>M:
  	print(N-M)
else:
  	print(-1)

Submission status: Runtime Error

Solution code:
N=int(input())
M=int(input())
if N>M:
    print(N-M)
else:
  	print(-1)

Submission status: Runtime Error

Solution code:
N=int(input())
M=int(input())
if N>M:
  print(N-M)
else:
  print(-1)

Submission status: Runtime Error

Solution code:
N=int(input())
if N>M:
  print(N-M)
else:
  print(-1)

Submission status: Runtime Error

Solution code:
a = input().split(" ")
b = input().split(" ")
c = 0
for i in b:
    c += int(i)
if a >= c:
    print(a - c)
else:
    print(-1)

Submission status: Runtime Error

Solution code:
# summer vacations, number of assignments
N, M = list(map(int, input().split()))
# each entry in A represents number of days to do the assignment
A = list(map(int, input().split()))

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

Submission status: Runtime Error

Solution code:
# summer vacations, number of assignments
N, M = list(map(int, input().split()))
# each entry in A represents number of days to do the assignment
A = list(map(int, input().split()))

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

Submission status: Runtime Error

Solution code:
yasumi = 0
syukudai = 1
nissu = list(map(int,input().split()))
syukudaiNissu = list(map(int,input().split()))
if sum(syukudaiNissu) > nissu[yasumi]:
  print()-1
print(nissu[yasumi] - sum(syukudaiNissu))

Submission status: Runtime Error

Solution code:
N = int(input())
M = int(input())
for i in range(M):
     N = N - int(input())
if N >= 0:
    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())

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

Submission status: Runtime Error

Solution code:
days, _ = [input(i) for i in input().strip().split()]
hw = [input(i) for i in input().strip().split()]
print(days - sum(hw))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
p=3.1415

print(2*n*p)

Submission status: Runtime Error

Solution code:
n = int(input())
p=3.142
print(2*n*p)

Submission status: Runtime Error

Solution code:
n = int(input())
p=3.142
print(2*n*p)

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:
nums = input().split()
N = nums[0]
M = nums[1]

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

print(N - count)

Submission status: Runtime Error

Solution code:
n,m = int(input()),int(input())
if n > 10**6 or n<1:
  n = int(input())
if m > 10**4 or n<1:
  m = int(input())
a = int(input())
for i in range(m):
  while a < 1 or a > 10**4:
    a = int(input)
  n -= a
if n >= 0:
  print(n)
else:
  print(-1)

Submission status: Runtime Error

Solution code:
n,m = int(input()),int(input())
for i in range(m):
  n -= int(input())
if n >= 0:
  print(n)
else:
  print(-1)

Submission status: Runtime Error

Solution code:
N = input()
M = input()
sumA = 0
for i in range(int(M)):
    sumA += int(input())
playday = int(N)-sumA
if playday >= 0:
    print(playday)
else:
    print(-1)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
m,n = map(int,input().split())
l = list(map(int,input().split()))
for i in range(n):
  s += l[i]
print(max(m-s,-1))

Submission status: Runtime Error

Solution code:
n,m= map(int,input().split())
a=list(map(int, intput().split()))
sum=0
for _ in range(len(a)):
  sum+=a[i]
if sum>n: 
  print("-1")
else:
  print(n-sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
days, homework = map(int, input().split())
a = input().split()

c = 0
for b in a:
  c += b

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

Submission status: Runtime Error

Solution code:
N=()
M=()
A=()

N=int(input(""))
M=int(input(""))
      
for i in range (0,M):
      A=int(input(""))
      N=(N-A)
      
if N<0:
      print("-1")
else:
      print(N)

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
days, assi = map(int, input().split())
lst = []
for i in range(assi):
    i = int(input())
    lst.append(i)
    tot = sum(lst)
if (days > tot):
    print(days-tot)
elif (days == tot):
    print(days-tot)
else:
    print('-1')

Submission status: Runtime Error

Solution code:
days, assi = map(int, input().split())
lst = []
while(assi > 1):
    a = list(map(int, input().split()))
    assi -= 1
    tot = sum(a)
if (days > tot):
    print(days-tot)
elif (days == tot):
    print(days-tot)
else:
    print('-1')

Submission status: Runtime Error

Solution code:
days , assi = map(int,input().split())
lst = []
while(assi > 0):
    a = int(input())
    assi -= 1
    lst.append(a)
    tot = sum(lst)
if (days > tot):
    print(days-tot)
elif (days == tot):
    print(days-tot)
else:
    print('-1')

Submission status: Runtime Error

Solution code:
days = int(input())
assi = int(input())
lst = []
while(assi > 0):
    a = int(input())
    assi -= 1
    lst.append(a)
    tot = sum(lst)
if (days > tot):
    print(days-tot)
elif (days == tot):
    print(days-tot)
else:
    print('-1')

Submission status: Runtime Error

Solution code:
days = int(input())
assi = int(input())
lst = []
while(assi > 0):
    a = int(input())
    assi -= 1
    lst.append(a)
    tot = sum(lst)
if (days > tot):
    print(days-tot)
elif (tot == days):
    print(days-tot)
else:
    print('-1')

Submission status: Runtime Error

Solution code:
N,M,A_i=(int,input().split())
A=0
for i in range(M):
    A+=A_i
if N<A:
    print("-1")

else:
    print(N-A)

Submission status: Runtime Error

Solution code:
N,M,A_i=(int(x) for x in input().split())
A=0
for i in range(M):
    A+=A_i
if N<A:
    print("-1")

else:
    print(N-A)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
li=list(map(int,input().split()))
g=n-sum(li)
if g>=0:
    print g
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 m:
  sum += A[i]

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
print('number of days of summer vacation: ')
N = int(input())
print('number of summer assignments: ')
M = int(input())

for i in range(M):
    Ai = int(input())
    N = N - Ai

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

Submission status: Runtime Error

Solution code:

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10000000)

#const
dxdy=((1,0),(0,1))
#my functions here!
def pin(type=int):
    return map(type,input().rstrip().split())
from math import gcd

#your code here!
def resolve():
    N,M=pin()
    A=(pin())
    t=(N)-sum(A)
    #print(t)
    ans=t if t>-1 else -1
    print(ans)

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """41 2
5 6"""
        output = """30"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """10 2
5 6"""
        output = """-1"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """11 2
5 6"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """314 15
9 26 5 35 8 9 79 3 23 8 46 2 6 43 3"""
        output = """9"""
        self.assertIO(input, output)


if __name__ == "__main__":
    #unittest.main()

"""
    I wrote my code above!
"""
    resolve()#and submit 2 atcoder!

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a, _ =map(int,input().split())
li = [x for x in input().split()]
s = sum(li)
print(a-s)

Submission status: Runtime Error

Solution code:
m,n=map(int,input().split())
a=input().split()
while n>0:
  m= m-a[n-1]
  n=n-1
if m>=0:
  print(m)
else:
  print(-1)

Submission status: Runtime Error

Solution code:
a=input()
b=input()
s=0
for i in b
  s=s+b
if s>a[0]:
  print('-1')
if s<=a[0]:
  print(a[0]-s)

Submission status: Runtime Error

Solution code:
N = int(input())

A = []

for i in range(N-1):
  a = int(input())
  A.append(a)

B = []

for j in range(N-1):
  temp = 0
  for i in A:
    if i-2 == j:
      temp += 1
  B.append(temp)        
for j in range(N-1):
  print(B[j])

Submission status: Runtime Error

Solution code:
m,n=input().split()
while n>0:
  m=m-int(input())
  n=n-1
if m>=0:
  print(m)
else:
  print(-1)

Submission status: Runtime Error

Solution code:
m,n=input().split()
while n>0:
  m=m-int(input())
  n=n-1
print(n)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
 
if __name__ == "__main__":
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    ret = -1
    A_sum = sum(A)
    if not (A_sum < 0):
        ret = N - A_sum
    print(int(ret))

Submission status: Runtime Error

Solution code:
import math
a=input().split()
n,m=int(a[0]),int(a[1])
f=list(map(int,input().split()))
s=0
fl=0
s=sum(a)
if(s>=n):
  print(s-n)
else:
  print("-1")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
a=input().split()
n,m
f=input().split()
s=0
fl=0
for i in range(0,int(a[1])):
    if(s>=int(a[0])):
        break
        fl+=1
if(fl!=1):
    print(int(a[0])-s)
else:
    print("-1")

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
Q = 0
for i in range(1, M+1):
    p = int(input())
    Q += p

dayoff = N - Q

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

Submission status: Runtime Error

Solution code:
M, n = map(int, input().split())
A = input().split()
list = []
for i in range(1, M+1): 6 2 1 1 
    for j in range(n):
        print(j)

print(list)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
for n in range(A):
  A.append(n)
  SumA = sum(A)
if 1 <= N <= 10^6 and 1 <= M <= 10^4 and 1 <= SumA <= 10^4:
  R = N - SumA
  print(R)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
M,N = map(int,input().split())
user = list(eval(input().replace(" ",",")))
sum = 0
for i in user:
    sum = sum + int(i)
result = M - int(sum)
if result < 0:
    print("-1")
else:
    print(int(result))

Submission status: Runtime Error

Solution code:
M,N = map(eval,input().split())
user = list(eval(input().replace(" ",",")))
sum = 0
for i in user:
    sum = sum + int(i)
result = M - sum
if result < 0:
    print("-1")
else:
    print(int(result))

Submission status: Runtime Error

Solution code:
M,N = map(eval,input().split())
user = list(eval(input().replace(" ",",")))
sum = 0
for i in user:
    sum = sum + int(i)
result = M - sum
if result < 0:
    print("-1")
else:
    print(result)

Submission status: Runtime Error

Solution code:
M,N = map(eval,input().split())
user = list(eval(input().replace(" ",",")))
sum = 0
for i in user:
    sum = sum + i
result = M - sum
if result < 0:
    print("-1")
else:
    print(result)

Submission status: Runtime Error

Solution code:
N, M = map(int,input().split())
A = list(map(int,input().split()))
C = N - (A * M) - A[:-1]- A
print(C)

Submission status: Runtime Error

Solution code:
M,N = map(eval,input().split())
user = list(eval(input().replace(" ",",")))
sum = 0
for i in user:
    sum = sum + i
result = M - sum
if result < 0:
    print(-1)
else:
    print(result)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N = eval(input())
M = eval(input())
user = list(eval(input().replace(" ",",")))
sum = 0
for i in user:
    sum = sum + i
result = N - sum
if result < 0:
    print(-1)
else:
    print(result)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
if 1 <= N <= 10^6 and 1 <= M <= 10^4 and 1 <= A <= 10^4:
  Sum = sum(A)
  R = N - SumA
  print(R)

Submission status: Runtime Error

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

N = int(N)
M = int(M)

a = input().split()

a = int(a)


if sam(a) < N:
    print(N - sam(a))

if sam(a) > N:
    print(-1)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, M = map(int,input().split())
A, B = map(int,input().split())
C = N-(A*M)-(B-A)
print(C)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
user1 = eval(input().replace(" ",","))
user = list(eval(input().replace(" ",",")))
sum = 0
for i in user:
    sum = sum + i
result = list(user1)[0] - sum
if result < 0:
    print(-1)
else:
    print(result)

Submission status: Runtime Error

Solution code:
user1 = eval(input().replace(" ",","))
user = list(eval(input().replace(" ",",")))
sum = 0
for i in user:
    sum = sum + i
result = list(user1)[0] - sum
if result <= 0:
    print(-1)
else:
    print(result)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A = []

N = input()
M = input()
for i in range(M):
  A = A.append(input())
rest = N - sum(A)

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

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split(" "))
A = map(int, input().split(" "))
if 1 <= N <= 10^6 and 1 <= M <= 10^4 and 1 <= A <= 10^4:
  Sum = sum(A)
  R = N - Sum
  print(R)

Submission status: Runtime Error

Solution code:
user1 = eval(input().replace(" ",","))
user = list(eval(input().replace(" ",",")))
sum = 0
for i in user:
    sum = sum + i
print(list(user1)[0] - sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
timeofholiday=int(input())
sum=0
homework_num=int(input())
for i in range(homework_num):
  a=int(input())
  sum+=a
  
if sum > timeofholiday:
  print("-1")
else:
  print(timeofholiday-sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

S =sum(A)

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

Submission status: Runtime Error

Solution code:
user1 = eval(input())
user2 = eval(input())
user = list(eval(input().replace(" ",",")))
sum = 0
for i in user:
    sum = sum + i
print(user1 - sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

S =sum(A)

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

X = int(sum(A))

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

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))
else:
    print(-1)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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


b = 0
c = []

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

d = 0
  
for i in c:
  d += int(i)

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

Submission status: Runtime Error

Solution code:
N = int(input())
M = int(input())
a=N
for i in range(M):
  if(a>=0):
    b= int(input())
    a= a-b

  else:
    a=-1
    break
if (a<0):
  print(-1)
else:
  print(a)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
A = map(int, input().split())
if 1 <= N <= 10^6 and 1 <= M <= 10^4 and 1 <= A <= 10^4:
  fun = N - A
  print(fun)

Submission status: Runtime Error

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

N = int(a[0])
M = int(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 += int(i)

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

Submission status: Runtime Error

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

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

print(N)
print(M)

b = 0
c = []

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

d = 0
  
for i in c:
  d += int(i)

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

Submission status: Runtime Error

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

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

total = 0

for i in range m:
    total += c[i]

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

Submission status: Runtime Error

Solution code:
data = list(map(int, input().split()))
# data = list(map(int, "41 2 5 6".split()))

N = data[0] # days of summer vacation
M = data[1] # summer assignments

A = 0 # days to do the i-th assignment.

for i in range(2, M+2) :
    # print(data[i])
    A += data[i]

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

Submission status: Runtime Error

Solution code:
n,m=int(input.split())
s=0
for i in input.split():
  s=s+i
if s>n:
  print("-1")
else:
  print(n-s)

Submission status: Runtime Error

Solution code:
inputdata = list(map(input().split()))
# data = list(map(int, "41 2 5 6".split()))

N = data[0] # days of summer vacation
M = data[1] # summer assignments

A = 0 # days to do the i-th assignment.

for i in range(2, M+2) :
    # print(data[i])
    A += data[i]

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

Submission status: Runtime Error

Solution code:
day = list(int(input()))
ans = list(int(input()))
num = 0
for i in range(0, len(ans)):
    num += ans[i]

target = day[0] - num

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

Submission status: Runtime Error

Solution code:
l=list(map(int,input().split()))
homework=0
for i in range(l[1]):
    homework=homework+l[i+2]
free=l[0]-homework
if free<0:
    print(-1)
else:
    print(free)