from math import gcd def main(n, p): if n+1 == p: return "Yes" if n == 0: return "No" if n == 1: return "Yes" assert 0 n += 1 if gcd(n, p-1)-1: return "Yes" else: return "No" n, p = list(map(int, input().split())) print(main(n, p))