// Arup Guha
// 6/6/2023
// Slow GCD

using namespace std;
#include <iostream>

int main() {

    int a, b, res = -1;
    cin >> a >> b;

    // Try each possible multiple of the larger number against the smaller one.
    for (int i=max(a,b);; i+= max(a,b)) {
        if (i%a == 0) {
            res = i;
            break;
        }
    }

    // Ta da!
    cout << res << endl;
    return 0;
}
