#include #include #include using namespace std; int gcd(int a, int b){ if(a < b) swap(a,b); if(a % b == 0) return b; else return gcd(b, a%b); } int main(){ int a,b; cin >> a >> b; if(gcd(a,b) != 1){cout << -1 << endl; return 0;} int ans = 0; vector v(200000); for(int i=0;i<200000;i++) v[i] = false; for(int i=0;i<=a;i++){ for(int j=0;j<=b;j++){ v[j*a + i*b] = true; } } for(int i=1;i