#include using namespace std; int main(){ int a,b; cin>>a>>b; int l=lcm(a,b); for (int i=1;i<=a+b;i++){ if (i%a==b%i){ cout<