import sys input = sys.stdin.readline from math import gcd N,P=list(map(int,input().split())) if gcd(N+1,P-1)!=1: print("Yes") else: print("No")