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