import numpy as np



from sys import stdin





def main():

    n, m = map(int, stdin.readline().split())

    a = list(map(int, stdin.readline().split()))

    a = np.array(a)



    ans = n - np.sum(a)



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





if __name__ == "__main__":

    main()

from sys import stdin, setrecursionlimit





def main():

    input = stdin.buffer.readline

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

    sum_a = sum(list(map(int, input().split())))

    ans = n - sum_a

    if ans < 0:

        print((-1))

    else:

        print(ans)





if __name__ == "__main__":

    setrecursionlimit(10000)

    main()

import numpy as np
from sys import stdin


def main():
    n, m = map(int, stdin.readline().split())
    a = list(map(int, stdin.readline().split()))
    a = np.array(a)
    ans = n - np.sum(a)
    print(-1) if ans < 0 else print(ans)


if __name__ == "__main__":
    main()

from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n, m = list(map(int, input().split()))
    sum_a = sum(list(map(int, input().split())))
    ans = n - sum_a
    if ans < 0:
        print((-1))
    else:
        print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

-import numpy as np -from sys import stdin +from sys import stdin, setrecursionlimit -    n, m = map(int, stdin.readline().split()) -    a = list(map(int, stdin.readline().split())) -    a = np.array(a) -    ans = n - np.sum(a) -    print(-1) if ans < 0 else print(ans) +    input = stdin.buffer.readline +    n, m = list(map(int, input().split())) +    sum_a = sum(list(map(int, input().split()))) +    ans = n - sum_a +    if ans < 0: +        print((-1)) +    else: +        print(ans) +    setrecursionlimit(10000)