program ABC_088_A_InfiniteCoins
   implicit none
   integer N, A, r
   read(*, *) N, A
   r = mod(N, 500)
   if(r <= 250)then
       if( r <= A) then
	       write(*, *) 'Yes'
	   else
	       write(*, *) 'No'
	   end if
   else
       if(500-r <= A) then
	       write(*, *) 'Yes'
	   else
	       write(*, *) 'No'
	   end if
   end if
end program ABC_088_A_InfiniteCoins 