'use strict'

function main(s) {

  s = s.split('\n')[0].split(' ').map(n => Number(n));

  const a = s[0];
  const b = s[1];
  let c = a;
  let ans = -1;

  while(c <= 1e18) {
    if (c % a === 0 && c % b !== 0) {
      ans = c;
      break;
    }
    c += 1;
  }

  console.log(c);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
