import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); sc.close(); boolean[] b = new boolean[n]; for (int i = 1; i <= n; i++) { int v = (int) power(i, m, n); if (b[v]) { System.out.println("No"); return; } b[v] = true; } System.out.println("Yes"); } static long power(long x, long n, int m) { if (n == 0) { return 1; } long val = power(x, n / 2, m); val = val * val % m; if (n % 2 == 1) { x %= m; val = val * x % m; } return val; } }