program b
    implicit none

    integer n,m,x
    integer i
    real(8),allocatable::a(:)
   
    read(*,*) n,m
    allocate(a(m))
    read(*,*) a(:)
    x=0.d0
    do i=1,m
      x=x+a(i)
    end do
    
    if(n >= x)then 
    write(*,*) n-x
    else 
    write(*,*) -1
    endif

end program b