SP1671 AMATH - Another Mathematical Problem

Description

Given two numbers n (1

Input Format

Multiple test cases. Each test case contains two space-separated integers n and k. Input terminate by EOF. The number of test cases will not more than 20.

Output Format

For each test case, you should output the smallest positive integer number T which satisfies the condition above, or -1 if it doesn't exist.