program main
  implicit none
  integer :: n, a
  read *, n
  read *, a
  if (a >= 499) then
    print "(a)", "Yes"
  else if (modulo(n, 500) <= a) then
    print "(a)", "Yes"
  else
    print "(a)", "No"
  end if
end program main
