program main
implicit none
integer :: i, j, k
integer :: n, a, m

read(*,*) n
read(*,*) a
m = n/500
do i = 1, m
   if( n - 500*i .le. a ) then
      write(*,*) 'Yes'
      stop
   end if
end do
write(*,*) 'No'



end program main
