#include <iostream>
using namespace std;
int main() {
int n, m, p;
while(cin >> n >> m) {
if (m > n) { //NOD
p = n;
n = m;
m = p;
}
while (m > 0) {
p = n % m;
if (p != 0) {
n = m;
m = p;
}
else break;
}
cout<<(m==1?"YES": "NO")<<endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPiAKdXNpbmcgbmFtZXNwYWNlIHN0ZDsgCmludCBtYWluKCkgeyAKCWludCBuLCBtLCBwOyAKCXdoaWxlKGNpbiA+PiBuID4+IG0pIHsKCQlpZiAobSA+IG4pIHsgLy9OT0QKCQkJcCA9IG47IAoJCQluID0gbTsgCgkJCW0gPSBwOyAKCQl9IAoJCXdoaWxlIChtID4gMCkgeyAKCQkJcCA9IG4gJSBtOyAKCQkJaWYgKHAgIT0gMCkgewoJCQkJbiA9IG07IAoJCQkJbSA9IHA7IAoJCQl9IAoJCQllbHNlIGJyZWFrOyAKCSAgICB9IAoJCWNvdXQ8PChtPT0xPyJZRVMiOiAiTk8iKTw8ZW5kbDsKCX0gCglyZXR1cm4gMDsgCn0=