PROGRAM abc088
    IMPLICIT NONE
    INTEGER I,N
    READ *,N
    READ *,I
    IF(i>=500) then
        WRITE (*,"(G3.0)") "Yes"
    else
        if (i>=mod(N,500)) then
            WRITE (*,"(G3.0)") "Yes"
        else
            WRITE (*,"(G2.0)") "No"
        END IF
    END IF
    
END 

            