import scala.io.StdIn._

object Main extends App {
  val N: Int = readInt()
  val A: Int = readInt()

  val div : Int = N / 500
  if ((N - 500 * div) > 1 * A) {
    println("No")
  } else {
    println("Yes")
  }