Codeforces Round 467 (Div. 2)
B
Vile Grasshoppers
Codeforces
1400
原题
← AC →
翻译中…

The weather is fine today and hence it's high time to climb the nearby pine and enjoy the landscape.

翻译中…

The pine's trunk includes several branches, located one above another and numbered from $2$ to $*y*$. Some of them (more precise, from $2$ to $*p*$) are occupied by tiny vile grasshoppers which you're at war with. These grasshoppers are known for their awesome jumping skills: the grasshopper at branch $*x*$ can jump to branches image.

翻译中…

Keeping this in mind, you wisely decided to choose such a branch that none of the grasshoppers could interrupt you. At the same time you wanna settle as high as possible since the view from up there is simply breathtaking.

翻译中…

In other words, your goal is to find the highest branch that cannot be reached by any of the grasshoppers or report that it's impossible.

翻译中…

Input

翻译中…

The only line contains two integers $*p*$ and $*y*$ $(2 ≤ *p* ≤ *y* ≤ 10^{9})$.

翻译中…

Output

翻译中…

Output the number of the highest suitable branch. If there are none, print -1 instead.

翻译中…

Note

翻译中…

In the first sample case grasshopper from branch $2$ reaches branches $2$, $4$ and $6$ while branch $3$ is initially settled by another grasshopper. Therefore the answer is $5$.

翻译中…

It immediately follows that there are no valid branches in second sample case.

翻译中…

样例

Input #1
3 6
Output #1
5
InputCopy OutputCopy
Input #2
3 4
Output #2
-1
InputCopy OutputCopy
题目信息
题号
937B
时间限制
1 s
内存限制
256 MB
标签
暴力
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。