program proA
  implicit none
  integer n,a,i

  read(*,*) n
  read(*,*) a

  do i=0,a
     if(i==mod(n,500)) then
        write(*,*) 'Yes'
        stop
     end if
  end do
  
  write(*,*) 'No'  
  
end program proA
