object InfiniteCoin extends App{
       val n = scala.io.StdIn.readInt
       val a = scala.io.StdIn.readInt

       val ans = if((n-a)%500 == 0){
           "Yes"
        }else{
           "No"
           }
        println(ans)
        }
        
