
fun main(args: Array<String>) {
    val n = readInt()
    val a = readInt()
    val b = n % 500
    println(if (b <= a) "Yes" else "No")
}

fun readIntList(): List<Int> = readLine()!!.split(' ').map { it.toInt() }

fun readInt(): Int = readLine()!!.toInt()

fun err(print: Any) {
    System.err.println(print)
}