One day, after a difficult lecture a diligent student Sasha saw a graffitied desk in the classroom. She came closer and read: "Find such positive integer *n*, that among numbers *n* + 1, *n* + 2, ..., 2·*n* there are exactly *m* numbers which binary representation contains exactly *k* digits one".

The girl got interested in the task and she asked you to help her solve it. Sasha knows that you are afraid of large numbers, so she guaranteed that there is an answer that doesn't exceed 10<sup class="upper-index">18</sup>.
The first line contains two space-separated integers, *m* and *k* (0 ≤ *m* ≤ 10<sup class="upper-index">18</sup>; 1 ≤ *k* ≤ 64).
def C(n,k):
    if n<0 or k<0 or n<k:
        return 0
    y=1
    for i in range(n-k+1,n+1):
        y*=i
    for i in range(2,k+1):
        y//=i
    return y
m,k=[int(e) for e in input().split()]
def f(x):
    p=0
    while 2**(p+1)<=x:
        p+=1
    s=C(p,k)
    b=[i for i in range(60) if x&(1<<i)][::-1]
    for i in range(len(b)):
        s+=C(b[i],k-i)
    return s
L=1
R=10**18
while R>L+1:
    M=(L+R)//2
    if f(2*M)-f(M)>=k:
        L=M
    else:
        R=M
if f(2*L)-f(L)==k:
    print(L)
else:
    print(R)