program main
    implicit none
    integer n,m
    integer,allocatable::a(:)
    read(*,*) n,m
    allocate(a(m))
    read(*,*) a(1:m)
    n=n-sum(a(1:m))
    if(n>=0) write(*,*) n 
    if(n<0) write(*,*) "-1"
end program main

