object Main {
  val judge = (ret: Boolean, ok: String, ng: String) => if (ret) println(ok) else println(ng)
  val canPay = (a: Int, n: Int) => if (n % 500 <= a) true else false

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n, a = sc.nextInt
    val ret = canPay(a,n)
    judge(ret, "Yes", "No")
  }
}
