   program abc163b
      implicit none
      integer::n,m
      integer,allocatable,dimension(:)::a
      integer::i,play

         read *, n,m
         allocate(a(m))
         read *, a(1:m)

         play=n
         do i=1,m
            play=play-a(i)
         end do

         if (play<0) then
            print *, '-1'
         else
            print *, play
         end if

   end program abc163b