# import sys

# sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

def II(): return int(eval(input()))



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

def MI1(): return list(map(int1, input().split()))



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

def LLI(rows_number): return [LI() for _ in range(rows_number)]





def solve():

    n, m = MI()

    A = LI()



    sm = sum(A)

    if n - sm >= 0:

        print((n - sm))

    else:

        print((-1))





if __name__ == '__main__':

    solve()

import sys

sys.setrecursionlimit(10 ** 6)

# input = sys.stdin.readline    ####

int1 = lambda x: int(x) - 1

def II(): return int(eval(input()))



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

def MI1(): return list(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)]



INF = float('inf')



def solve():

    n, m = MI()

    A = LI()



    s = sum(A)

    print((max(n - s, -1)))





if __name__ == '__main__':

    solve()

# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1


def II():
    return int(eval(input()))


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


def MI1():
    return list(map(int1, input().split()))


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


def LLI(rows_number):
    return [LI() for _ in range(rows_number)]


def solve():
    n, m = MI()
    A = LI()
    sm = sum(A)
    if n - sm >= 0:
        print((n - sm))
    else:
        print((-1))


if __name__ == "__main__":
    solve()

import sys

sys.setrecursionlimit(10**6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1


def II():
    return int(eval(input()))


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


def MI1():
    return list(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)]


INF = float("inf")


def solve():
    n, m = MI()
    A = LI()
    s = sum(A)
    print((max(n - s, -1)))


if __name__ == "__main__":
    solve()

-# import sys -# sys.setrecursionlimit(10 ** 6) +import sys + +sys.setrecursionlimit(10**6) +# input = sys.stdin.readline    #### +def LI1(): +    return list(map(int1, input().split())) + + + + +INF = float("inf") -    sm = sum(A) -    if n - sm >= 0: -        print((n - sm)) -    else: -        print((-1)) +    s = sum(A) +    print((max(n - s, -1)))