import scala.io.StdIn._

object Main {
    def main(args: Array[String]): Unit = {
        val t = readLine.toInt % 500
        println(if (t <= readLine.toInt) {
            "Yes"
        } else {
            "No"
        })
    }
}