import scala.io.StdIn._
object Main extends App{
  val sc = new java.util.Scanner(System.in)
  var n = sc.nextInt
  val a = sc.nextInt
  n=n-500*(n/500)
  if(n<=a){
    println("Yes")
  }
  else{
    println("No")
  }
}