Jamie is preparing a Codeforces round. He has got an idea for a problem, but does not know how to solve it. Help him write a solution to the following problem:

Find k integers such that the sum of two to the power of each number equals to the number n and the largest integer in the answer is as small as possible. As there may be multiple answers, you are asked to output the lexicographically largest one. 

To be more clear, consider all integer sequence with length k (a_1, a_2, ..., a_{k}) with $\sum_{i = 1}^{k} 2^{a_{i}} = n$. Give a value $y = \operatorname{max}_{1 \leq i \leq k} a_{i}$ to each sequence. Among all sequence(s) that have the minimum y value, output the one that is the lexicographically largest.

For definitions of powers and lexicographical order see notes.


-----Input-----

The first line consists of two integers n and k (1 ≤ n ≤ 10^18, 1 ≤ k ≤ 10^5) — the required sum and the length of the sequence.


-----Output-----

Output "No" (without quotes) in a single line if there does not exist such sequence. Otherwise, output "Yes" (without quotes) in the first line, and k numbers separated by space in the second line — the required sequence.

It is guaranteed that the integers in the answer sequence fit the range [ - 10^18, 10^18].


-----Examples-----
Input
23 5

Output
Yes
3 3 2 1 0 

Input
13 2

Output
No

Input
1 2

Output
Yes
-1 -1 



-----Note-----

Sample 1:

2^3 + 2^3 + 2^2 + 2^1 + 2^0 = 8 + 8 + 4 + 2 + 1 = 23

Answers like (3, 3, 2, 0, 1) or (0, 1, 2, 3, 3) are not lexicographically largest.

Answers like (4, 1, 1, 1, 0) do not have the minimum y value.

Sample 2:

It can be shown there does not exist a sequence with length 2.

Sample 3:

$2^{-1} + 2^{-1} = \frac{1}{2} + \frac{1}{2} = 1$

Powers of 2:

If x > 0, then 2^{x} = 2·2·2·...·2 (x times).

If x = 0, then 2^{x} = 1.

If x < 0, then $2^{x} = \frac{1}{2^{-x}}$.

Lexicographical order:

Given two different sequences of the same length, (a_1, a_2, ... , a_{k}) and (b_1, b_2, ... , b_{k}), the first one is smaller than the second one for the lexicographical order, if and only if a_{i} < b_{i}, for the first i where a_{i} and b_{i} differ.

Difficulty: interview

Starter code:

Solutions:
from collections import defaultdict

def solve(n, k):
    as_bin = bin(n)[2:]
    cnt = defaultdict(int)
    cnt.update({i : 1 for i, b in enumerate(reversed(as_bin)) if b == '1'})
    curr_len = len(cnt)
    curr_pow = len(as_bin) - 1

    if curr_len > k:
        return None

    while True:
        new_len = curr_len + cnt[curr_pow]
        if new_len > k:
            break
        cnt[curr_pow - 1] += 2 * cnt[curr_pow]
        del cnt[curr_pow]
        curr_pow -= 1
        curr_len = new_len

    i = min(cnt.keys())
    while curr_len < k:
        cnt[i] -= 1
        cnt[i - 1] += 2
        curr_len += 1
        i -= 1

    ans = []
    for i in sorted(list(cnt.keys()), reverse=True):
        ans.extend([i] * cnt[i])
    return ans

n, k = [int(v) for v in input().split()]
ans = solve(n, k)

if ans is None:
    print('No')
else:
    print('Yes')
    print(' '.join(str(c) for c in ans))


from collections import defaultdict

def solve(n, k):
    as_bin = bin(n)[2:]
    cnt = defaultdict(int)
    cnt.update({i : 1 for i, b in enumerate(reversed(as_bin)) if b == '1'})
    curr_len = len(cnt)
    curr_pow = len(as_bin) - 1

    if curr_len > k:
        return None

    while True:
        new_len = curr_len + cnt[curr_pow]
        if new_len > k:
            break
        cnt[curr_pow - 1] += 2 * cnt[curr_pow]
        del cnt[curr_pow]
        curr_pow -= 1
        curr_len = new_len

    ans = []
    for i in sorted(list(cnt.keys()), reverse=True):
        ans.extend([i] * cnt[i])

    if curr_len < k:
        last = ans.pop()
        ans.extend(reversed(list(range(last - (k - curr_len), last))))
        ans.append(ans[-1])

    return ans

n, k = [int(v) for v in input().split()]
ans = solve(n, k)

if ans is None:
    print('No')
else:
    print('Yes')
    print(' '.join(str(c) for c in ans))


def count1(n):
    count = 0
    while n > 0:
        n &= (n-1)
        count+= 1
    return count


def find(n, k):
    ones = count1(n)
    l = list()
    if ones > k:
        print('No')
    else:
        tmp = n
        pow2 = 1
        index = 0
        while tmp > 0:
            if tmp % 2 == 1:
                l.append(index)
            tmp //= 2
            pow2 *= 2
            index += 1
        length = len(l)
        while length < k:
            m = max(l)
            c = l.count(m)
            rem = [i for i in l if i < m]
            if k - length >= c:
                rem += [m-1]*(2*c)
                l = rem
                length = len(l)
            else:
                # to_add = k - length
                # rem += [m] * (c - to_add) + [m-1] * (to_add * 2)
                mini = min(l)
                to_fill  = k - length
                l.remove(mini)
                for i in range(to_fill):
                    mini -=1
                    l.append(mini)
                l.append(mini)
                break
        print('Yes')
        l.sort(reverse=True)
        # print(len(l))
        print(' '.join([str(i) for i in l]))

# find(23,5)
# find(13,2)
# find(1,2)
nn, kk = list(map(int, input().strip().split()))
find(nn, kk)

# find(1000000000000000000, 100000)


n, k = map(int, input().split())
cnt = [0] * 200010
ans = ''
for i in range(64):
  if (n >> i)&1:
    k -= 1
    cnt[i] = 1;
if k < 0:
  print("No")
else:
  print("Yes")
  for i in range(64, -64, -1):
    if k >= cnt[i]:
      cnt[i - 1] += cnt[i] * 2
      k -= cnt[i]
      cnt[i] = 0
    else: break
  for i in range(-64, 64):
    if cnt[i]:
      while k:
        cnt[i] -= 1
        cnt[i - 1] += 2 
        i -= 1
        k-= 1
      break
  for i in range(64, -100010, -1): ans += (str(i) + ' ') * cnt[i] 
  print(ans)

#! /usr/bin/env python3
'''
Author:    krishna
Created:   Fri Jan 19 20:39:10 2018 IST
File Name: b.py
USAGE:
      b.py
Description:

'''
import sys, os


def main():
    '''
    The Main
    '''
    n, k = list(map(int, sys.stdin.readline().split()))

    x =  bin(n)[2:]
    if x.count('1') > k:
        print("No")
        return

    ans = [0] * (10 ** 5)

    val = len(x) - 1
    idx = len(x) - 1
    cnt = 0
    for i in x:
        if (int(i)):
            ans[val] = 1
            # print(val)
            cnt += 1

        val -= 1

    for i in range(k-cnt):
        ans[idx] -= 1
        ans[idx-1] += 2
        if (ans[idx] == 0):
            idx -= 1

    # print(ans[18])
    # return

    maxIdx = idx - 1
    minIdx = idx - 1
    nonZeroIdx = idx - 1
    while (1):
        if (minIdx < 0) and (ans[minIdx] == 0):
            minIdx += 1
            break
        if ans[minIdx]:
            nonZeroIdx = minIdx
        minIdx -= 1

    minIdx = nonZeroIdx
    # print(ans[0:10])
    # print(maxIdx, minIdx)

    while (1):
        if (
            (ans[maxIdx] > 2)
            or ((ans[maxIdx] == 2 )and (maxIdx != minIdx))
        ):
            ans[minIdx] -= 1
            ans[minIdx - 1] += 2
            ans[maxIdx] -= 2
            ans[maxIdx + 1] += 1
            minIdx -= 1
        else:
            maxIdx -= 1

        if (maxIdx <= minIdx):
            break


    print("Yes")
    x = []
    while (1):
        for i in range(ans[idx]):
            x.append(idx)
        idx -= 1
        if (idx < 0) and (ans[idx] == 0):
            break

    # print([(i, ans[i]) for i in range(len(ans)) if ans[i] < 0])
    # print(sum(ans))
    # print(len(x))
    print(" ".join(map(str, x)))


def __starting_point():
   main()

__starting_point()

n, k = map(int, input().split())
c = [0] * 200010
k -= c.count(1)

for i in range(64):
    if (n >> i) & 1:
        k -= 1
        c[i] = 1

if k < 0:
    print('No')
else:
    print('Yes')

    for i in range(64, -64, -1):
        if k >= c[i]:
            c[i - 1] += c[i] * 2
            k -= c[i]
            c[i] = 0
        else:
            break

    for i in range(-64, 64):
        if c[i]:
            while k:
                c[i] -= 1
                c[i - 1] += 2
                i -= 1
                k -= 1
            break

    for i in range(64, -100010, -1):
        print('{} '.format(i) * c[i], end='')


n,m = list(map(int,input().split()))
max_pows = -1
temp = n
list_pow = {}
while temp >0:
    factor = -1
    index = 1
    while index <= temp:
        index *=2
        factor +=1
    temp = temp - index//2
    if max_pows == -1:
        max_pows = factor
    list_pow[factor] = 1
min_pows = factor
if len(list_pow) > m:
    print("No")
else:
    pow_count = len(list_pow)
    cur_pow = max_pows
  
    while pow_count + list_pow[cur_pow] <=m:
        list_pow[cur_pow] -=1
        if cur_pow - 1 in list_pow:
            list_pow[cur_pow - 1] +=2
        else:
            list_pow[cur_pow - 1] = 2
        pow_count +=1
        if list_pow[cur_pow]==0: 
            cur_pow -=1
        min_pows = min(min_pows,cur_pow)    
            
    cur_pow = min_pows
    
    while pow_count!= m:
        list_pow[cur_pow] -=1
        if cur_pow - 1 in list_pow:
            list_pow[cur_pow - 1] +=2
        else:
            list_pow[cur_pow - 1] = 2
        pow_count +=1
        cur_pow -=1        
    print("Yes")
    cur_count = 0
    while cur_count !=m:
        if max_pows in list_pow:
            for i in range(list_pow[max_pows]):
                cur_count +=1
                print(max_pows,end = " ")
        max_pows -=1
        


from collections import *
N, K = list(map(int, input().split()))

a = deque()
for i in range(60): # 2**60 > 1e18
	if N & (1<<i):
		a.appendleft([i,1])
k = len(a)

if k > K:
	print("No")
	return

# high
while k + a[0][1] <= K:
	e, c = a.popleft()
	if len(a) == 0 or a[0][0] != e - 1:
		a.appendleft([e-1,0])
	a[0][1] += 2 * c
	k += c

# low
if K - k:
	a[-1][1] -= 1
	count = K - k
	first = a[-1][0] - 1
	last = first - count + 1
	for i in range(first, last - 1, -1):
		a.append([i,1])
	a.append([last,1])
	k = K

ans = []		
for i in a:
	ans += [i[0]] * i[1]
ans = list(map(str, ans))
ans = "Yes\n" + " ".join(ans)
print(ans)


n, k = map(int,input().split())

bits = [0 for i in range(128)]
tmp = n
sumBits = 0

for i in range(64):
    if tmp%2==1:
        bits[63-i] = 1
        sumBits += 1
    tmp = tmp>>1
if sumBits>k:
    print("No")
elif sumBits==k:
    print("Yes")
    res = []
    for i in range(63,-1,-1):
        if bits[63-i] == 1:
            res.append(i)
    print(*res)
else:
    ind = 0
    while k!=sumBits:
        if bits[ind] != 0:
            if bits[ind]<=k-sumBits:
                bits[ind+1] += 2*bits[ind]
                sumBits += bits[ind]
                bits[ind] = 0
            else:
                break
        ind += 1
    if k!=sumBits:
        for i in range(127,-1,-1):
            if bits[i] != 0:
                bits[i] -= 1
                first = i + 1
                break
        if k - sumBits < 128 - first:
            for i in range(first,k - sumBits + first):
                bits[i] = 1
            bits[k - sumBits + first - 1] = 2
        else:
            for i in range(first,128):
                bits[i] = 1
            bits += [1]*(k - sumBits + first - 128)
            bits[-1] = 2
    print("Yes")
    res = []
    for i in range(len(bits)):
        if bits[i] != 0:
            res += [63-i]*bits[i]
    print(*res)

from collections import Counter
bits = (10**18).bit_length()
n, k = map(int, input().split())
num = Counter(i for i in range(bits) if (n >> i) & 1)
k -= len(num)
if k >= 0:
	print('Yes')
	for i in range(bits, -bits, -1):
		if num[i] > k: break
		num[i-1] += num[i] * 2
		k -= num.pop(i, 0)
	i = next(filter(num.get, range(-bits, bits)))
	for k in range(k):
		num[i] -= 1
		num[i-1] += 2
		i -= 1
	s = sorted(num.elements(), reverse=True)
	print(' '.join(map(str, s)))
else:
	print('No')

inp=lambda:map(int,input().split())
n,k=inp()
n2=n

a=[0]*100
i=0

while(n2>0):
    a[i]=n2%2
    n2//=2
    i+=1

cnt=i-1
cnt2=cnt
sum=0
arr=[0]*(10**7+1)
q=[0]*(10**7+1)


for i in range(cnt,-1,-1):
    sum+=a[i]
    q[i]=a[cnt-i]

if sum>k:
    print("No")
    quit()

k2=k-sum

beg=0
while k2>0:
    if(q[beg]<=k2):
        k2-=q[beg]
        q[beg+1]+=2*q[beg]
        q[beg]=0
        beg+=1
    else:
       break

cnt+=1000

while(q[cnt]==0):
    cnt-=1   



while k2>0:
    q[cnt]-=1
    q[cnt+1]+=2
    cnt+=1
    k2-=1
   



print("Yes")
 
for i in range(beg,cnt+1):
    for j in range(1,q[i]+1):
        print(cnt2-i,'', end='')


inp=lambda:map(int,input().split())
n,k=inp()
n2=n

a=[0]*100
i=0

while(n2>0):
    a[i]=n2%2
    n2//=2
    i+=1

cnt=i-1
cnt2=cnt
sum=0
arr=[0]*(10**7+1)
q=[0]*(10**7+1)


for i in range(cnt,-1,-1):
    sum+=a[i]
    q[i]=a[cnt-i]

if sum>k:
    print("No")
    quit()

k2=k-sum

beg=0
while k2>0:
    if(q[beg]<=k2):
        k2-=q[beg]
        q[beg+1]+=2*q[beg]
        q[beg]=0
        beg+=1
    else:
       break

cnt+=1000

while(q[cnt]==0):
    cnt-=1   



while k2>0:
    q[cnt]-=1
    q[cnt+1]+=2
    cnt+=1
    k2-=1
   



print("Yes");
 
for i in range(beg,cnt+1):
    for j in range(1,q[i]+1):
        print(cnt2-i,'', end='')


def solve(n, k):
    bn = binary(n)
    if k < len(bn):
        return 'No'

    cur_dec = len(bn)
    next_dec = cur_dec+1
    while True:
        if k < next_dec:
            dif = k - cur_dec
            bn = list(reversed(bn))
            for _ in range(dif):
                e = bn.pop()
                bn += [e-1, e-1]
            return 'Yes\n' + ' '.join(map(str,bn))
        cur_dec = next_dec
        cnt = bn.count(bn[-1])
        bn = bn[:-cnt] + [bn[-1]-1]*(cnt*2)
        next_dec = cur_dec+bn.count(bn[-1])



def binary(x):
    out = []
    for i in reversed(list(range(64+1))):
        if x >= 2**i:
            x -= 2**i
            out.append(i)
    return list(reversed(out))


def __starting_point():
    n, k = list(map(int, input().split()))
    print(solve(n, k))

__starting_point()

read = lambda: map(int, input().split())
n, k = read()
b = bin(n)[2:]
bl = len(b)
k -= b.count('1')
if k < 0:
    print('No')
    return
print('Yes')
m = -2
a = {}
for _ in range(bl):
    if b[_] == '1':
        a[bl - _ - 1] = 1
        if m is -2:
            m = bl - _ - 1
while k > 0:
    if k >= a[m]:
        k -= a[m]
        a[m - 1] = a.get(m - 1, 0) + a[m] * 2
        a.pop(m)
        m -= 1
    else:
        break
m = min(a.keys())
while k > 0:
    k -= 1
    if a[m] is 1:
        a.pop(m)
    else:
        a[m] -= 1
    a[m - 1] = a.get(m - 1, 0) + 2
    m -= 1
for k in sorted(list(a.keys()), reverse=True):
    print(('%d ' % k) * a[k], end='')


#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2017/10/20 13:52
# @Author  : litianshuang
# @Email   : litianshuang@jingdata.com
# @File    : test.py
# @Desc    :


def __starting_point():
    h, k = [int(n) for n in input().split(' ')]
    level = 0
    ret = []
    while h > 0:
        if h % 2 == 0:
            h //= 2
            level += 1
        else:
            ret.append(level)
            h -= 1
    if len(ret) > k:
        print('No')
    else:
        print('Yes')
        cntnum = {}
        maxn = ret[0]
        minn = ret[0]
        total_len = len(ret)
        for i in ret:
            if i not in cntnum:
                cntnum[str(i)] = 0
            cntnum[str(i)] += 1
            if maxn < i:
                maxn = i
            if minn > i:
                minn = i

        while total_len <= k:
            if total_len + cntnum[str(maxn)] <= k:
                if str(maxn - 1) not in cntnum:
                    cntnum[str(maxn - 1)] = 0
                cntnum[str(maxn-1)] += 2 * cntnum[str(maxn)]
                total_len += cntnum[str(maxn)]
                cntnum[str(maxn)] = 0
                maxn -= 1
                minn = min(minn, maxn)
            else:
                break

        while total_len < k:
            cntnum[str(minn - 1)] = 2
            cntnum[str(minn)] -= 1
            minn -= 1
            total_len += 1

        ans = []
        for num, v in list(cntnum.items()):
            for i in range(0, v):
                ans.append(int(num))
        ans.sort(reverse=True)

        print(" ".join([str(x) for x in ans]))

__starting_point()

n, k = list(map(int, input().split()))

cnt = [0] * 200010

ans = ''

for i in range(64):

  if (n >> i)&1:

    k -= 1

    cnt[i] = 1;

if k < 0:

  print("No")

else:

  print("Yes")

  for i in range(64, -64, -1):

    if k >= cnt[i]:

      cnt[i - 1] += cnt[i] * 2

      k -= cnt[i]

      cnt[i] = 0

    else: break

  for i in range(-64, 64):

    if cnt[i]:

      while k:

        cnt[i] -= 1

        cnt[i - 1] += 2 

        i -= 1

        k-= 1

      break

  for i in range(64, -100010, -1): ans += (str(i) + ' ') * cnt[i] 

  print(ans)



# Made By Mostafa_Khaled


read = lambda: map(int, input().split())
n, k = read()
b = bin(n)[2:]
bl = len(b)
k -= b.count('1')
if k < 0:
    print('No')
    return
print('Yes')
m = -2
a = {}
for _ in range(bl):
    if b[_] == '1':
        a[bl - _ - 1] = 1
        if m is -2:
            m = bl - _ - 1
while k > 0:
    if k >= a[m]:
        k -= a[m]
        a[m - 1] = a.get(m - 1, 0) + a[m] * 2
        a.pop(m)
        m -= 1
    else:
        break
m = min(a.keys())
while k > 0:
    k -= 1
    if a[m] is 1:
        a.pop(m)
    else:
        a[m] -= 1
    a[m - 1] = a.get(m - 1, 0) + 2
    m -= 1
for k in sorted(list(a.keys()), reverse=True):
    print(('%d ' % k) * a[k], end='')

n,k=map(int,input().split())
a=list(bin(n))
a=a[2:]
b=[]
for i in range(100005):
	b.append(0)
l=len(a)
c=0
for i in range(l):
	if(a[i]=="1"):
		b[65-(l-i-1)]=1
		c+=1
		lini=65-(l-i-1)
if(c<=k):
	gfati=0
	for i in range(129):
		if(gfati==1):
			break
		if(c==k):
			break
		if(b[i]==0):
			continue
		else:
			if(i>lini):
				lini=i
			#print(c,2*b[i])
			if(c+b[i]<=k):
				#print("why")
				b[i+1]+=2*b[i]
				c+=b[i]
				b[i]=0
			else:
				gfati=1
	#print(c,lini)
	if(1):
		for i in range(lini,1000005,1):
			if(c==k):
				break
			if(b[i]!=0):
				if(c+1<=k):
					b[i]-=1
					c+=1
					b[i+1]+=2
	print("Yes")
	for i in range(100005):
		if(b[i]!=0):
			for j in  range(b[i]):
				print(65-i,end=" ")
else:
	print("No")

ii=lambda:int(input())
kk=lambda:map(int, input().split())
ll=lambda:list(kk())

from math import log

elems = [0]*126
n,k=kk()
c=0
for i in range(63):
	if n&(2**i):
		elems[i]=1
		c+=1
if c > k:
	print("No")
	return
for i in range(63, -63,-1):
	if elems[i]:
		if elems[i] > k-c:
			#stop it, now reverse sweep
			break
		c+=elems[i]
		elems[i-1] += elems[i]*2
		elems[i] = 0
prin = []
for i in range(63, -63, -1):
	prin.extend([i]*elems[i])
while len(prin)<k:
	prin[-1]-=1
	prin.append(prin[-1])
print("Yes")
print(" ".join(map(str, prin)))

n, k = map(int, input().split())

s = list()
b = list()
base = 0
while n > 0:
    s.append(n%2)
    b.append(base)
    n //= 2
    base += 1
s.reverse() # indicate existence
b.reverse() # indicate which power of 2
# print(s)
# print(b)

t = sum(s)
if t > k:
    print('No')
    return
    
pos = 0
while t < k:
    if pos+1 == len(s): # extend if necessary
        s.append(0)
        b.append(b[-1] - 1)

    if t + s[pos] <= k:
        t += s[pos]
        s[pos+1] += 2 * s[pos]
        s[pos] = 0
        pos += 1        
    else:       
        for i in range(len(s)-1, -1, -1):
            if s[i] > 0:
                while t < k:
                    if i+1 == len(s):
                        s.append(0)
                        b.append(b[-1] - 1)                    
                    s[i] -= 1
                    s[i+1] += 2
                    t += 1
                    i += 1
                break

res = list() # comply with answer form
for i in range(len(s)):
    for j in range(s[i]):
        res.append(b[i])
print('Yes')
print(' '.join(map(str, res)))        

import math
x, k = list(map(int, input().split()))
kori = k
a = bin(x)

# s = a[2:len(a)]
qtz = 0;
s = []
for i in range(2, len(a)):
    if a[i] == "1":
        k-=1
        s.append(1)
    else:
        qtz+=1
        s.append(0)



v = []
for i in range(len(s)):
    if s[i] != 0:
        v.append((len(s)-1)-i)
    # else:
        # v.append("x")

# print(qtz, k)
if k < 0:
    print("No")
    return
else:
    tam = len(s)
    # print(tam)
    print("Yes")
    # print(k, s)
    if k > 0:
        p = 0
        #diminui o y máximo
        while(1):
            # print(p, s[p], len(s))
            if tam - 1 <= p:
                s.append(0)
            if s[p] > k:
                break
            else:
                k-= s[p]
                s[p+1] += s[p]*2
                s[p] = 0
                p+=1
        #se k ainda for maior que zero
        if k > 0:
            j = len(s)-1
            while k > 0:
                while s[j] == 0:
                    j-=1
                s[j] -= 1
                if j == len(s)-1:
                    s.append(2)
                    j+=1
                else:
                    s[j+1] += 2
                    j+=1
                k-=1


            # print(s)
        v = []
        for i in range(len(s)):
            for j in range(s[i]):
                v.append((tam-1) -i)
        print(*v)
    else:
        v = []
        for i in range(len(s)):
            for j in range(s[i]):
                v.append(len(s)-1 -i)
        print(*v)