Pumpkinomics


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C++, Java, Python

Frank has opened a new pumpkin farm and he aims to make it big in the farming industry. To get started, he ran an investment round, over-promising returns and safety. However, he didn't get any money from this, as the investors were not confident. Instead, he was only given a single giant pumpkin of size A.

Luckily, Frank has a magical pumpkin cloning device he found in the basement of the UNSW engineering building. By feeding it a pumpkin of size x, he can produce two healthy pumpkins with sizes \lfloor \frac{x}{2} \rfloor and \lfloor \frac{x}{3} \rfloor (both rounding down i.e. floor division). Frank can repeat this process as many times as he likes, but a pumpkin of size 0 cannot be cut, or else a black hole would be created.

Frank aims to enter the local pumpkin-growing contest. Winning would be a boon to his business, as all the local farmers would know his name and he would gain massive aura. The contest asks for B of the biggest distinctly-sized pumpkins, which Frank can create through repeatedly cloning different pumpkins, starting with the single pumpkin he received as an investment. What are the B biggest pumpkins that can be produced, in descending order of size, so Frank has the best possible chance at winning and making it big?

Input

The input contains two integers A and B, where A (1 \leq A \leq 10^{18}) represents the size of the pumpkin given to Frank as an investment, while B (1 \leq B \leq 10^5) represents the amount of distinctly sized pumpkins to be reported.

Output

Output B space-separated integers, where these are the biggest pumpkins that you can generate by repeatedly applying the cloning process to the initial pumpkin. The output should be all distinct sizes, and given in descending order. If it is impossible to make B distinctly-sized pumpkins, output all the possible pumpkins in descending order.

Example

Input 1
10 7
Output 1
10 5 3 2 1 0

These are the only pumpkins that are possible to create using the cloning machine, so we output them in descending order.

Input 2
127 6
Output 2
127 63 42 31 21 15

Comments

There are no comments at the moment.