program ABC163B
    implicit none
    integer(8)::N,M,i
    integer(8),allocatable,dimension(:)::A
    read*,N,M
    allocate(A(M))
    read*,A
    do i=1,M
        N=N-A(i)
    end do

    if(N<0)then
        print'(i0)',-1
    else
        print'(i0)',N
    end if
end program ABC163B