program abc163a
  implicit none
  integer n, m, a(10005), total, i
  total = 0
  read (*,*) n, m
  read (*,*) (a(i), i=1, m)
  do i=1, m
    total = total + a(i)
  end do
  if (n >= total) then
    print *, n-total
  else
    print *, -1
  end if
end program abc163a
