import Glibc
extension String: CollectionType {}

//var inp = readLine()!.split(" ").map { Int($0)! }
var n = Int(readLine()!)!
var a = Int(readLine()!)!
if n%500 <= a {
  print("Yes")
} else {
  print("No")
}