시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB70302946.774%

문제

Alice and Bob have an integer N. Alice and Bob are not happy with their integer. Last night they went to a cocktail party and found that another couple had the exact same integer! Because of that they are getting a new integer.

Bob wants to impress the other couple and therefore he thinks their new integer should be strictly larger than N.

Alice herself is actually fond of some specific integer k. Therefore, Alice thinks that whatever integer they pick, it should be possible to write it as a sum of k distinct powers of 2.

Bob is also a cheapskate, therefore he wants to spend as little money as possible. Since the cost of an integer is proportional to its size, he wants to get an integer that is as small as possible.

입력

  • A single line containing two integers N and k, with 1 ≤ N ≤ 1018 and 1 ≤ k ≤ 60.

출력

Output M, the smallest integer larger than N that can be written as the sum of exactly k distinct powers of 2.

예제 입력 1

1 2

예제 출력 1

3

예제 입력 2

12 2

예제 출력 2

17

예제 입력 3

1 5

예제 출력 3

31

예제 입력 4

182 3

예제 출력 4

193