object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val n = readLine.split(" ").map(_.toInt).head
    val a = readLine.split(" ").map(_.toInt).head
    val ans = (n % 500) <= a
    println(if(ans) "Yes" else "No")
  }
}
