program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,a
    read*, n
    read*, a
    if (mod(n,500) <= a) then
        print'(a)', 'Yes'
    else
        print'(a)', 'No'
    end if
end program main