8596: Headphones

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:2 通过:1

题目描述

One day, NIO's home is out of power. So Nio and his sister, Yasa, wanted to take some headphones  from the drawer. In the dark, If they randomly took some headphones. There are N pairs in total. Yasa is very lucky, so she had taken out exactly k distinct pairs of headphones (k×2 headphones and all of them are in pairs). How many headphones NIO should take to make sure that he gets more pairs than his sister, i.e., k+1 pairs of headphones under the worst case. Assume that there are N pairs of headphones in the drawer, and each pair is different from another. NIO takes one headphone once.

输入格式

The first line has two integers N and k , representing the number of the total number of pairs in the drawer and the number of pairs Yasa had taken. 
If it cannot guarantee that NIO will get more pairs of headphones than his sister, output −1.
1≤kN≤109

输出格式

Output the number of headphones NIO should get.

输入样例 复制

3 1

输出样例 复制

4

数据范围与提示

3 pairs of headphones = 6 headphones 
4 headphones = 4 headphones