AT_abc422_d [ABC422D] Least Unbalanced

Description

Let $ N $ be a positive integer. Define the **imbalance** of a sequence $ A=(A_1, A_2, \dots, A_{2^N}) $ of non-negative integers of length $ 2^N $ as the non-negative integer value obtained by the following operation: - Initially, set $ X=0 $ . - Perform the following series of operations $ N $ times: - Update $ X $ to $ \max(X, \max(A) - \min(A)) $ , where $ \max(A) $ and $ \min(A) $ denote the maximum and minimum values of sequence $ A $ , respectively. - Form a new sequence of half the length by pairing elements from the beginning two by two and arranging their sums. That is, set $ A \gets (A_1 + A_2, A_3 + A_4, \dots, A_{\vert A \vert - 1} + A_{\vert A \vert}) $ . - The final value of $ X $ is the imbalance. For example, when $ N=2, A=(6, 8, 3, 5) $ , the imbalance is $ 6 $ through the following steps: - Initially, $ X=0 $ . - The first series of operations is as follows: - Update $ X $ to $ \max(X, \max(A) - \min(A)) = \max(0, 8 - 3) = 5 $ . - Set $ A $ to $ (6+8, 3+5) = (14, 8) $ . - The second series of operations is as follows: - Update $ X $ to $ \max(X, \max(A) - \min(A)) = \max(5, 14 - 8) = 6 $ . - Set $ A $ to $ (14 + 8) = (22) $ . - Finally, $ X=6 $ . You are given a non-negative integer $ K $ . Among all sequences of non-negative integers of length $ 2^N $ with sum $ K $ , construct a sequence that minimizes the imbalance.

Input Format

The input is given from Standard Input in the following format: > $ N $ $ K $

Output Format

Let $ B=(B_1,B_2,\dots,B_{2^N}) $ be a sequence with minimum imbalance. Let $ U $ be the imbalance of $ B $ . Output a solution in the following format: > $ U $ $ B_1 $ $ B_2 $ $ \dots $ $ B_{2^N} $ If there are multiple solutions, any of them will be considered correct.

Explanation/Hint

### Sample Explanation 1 $ (5, 6) $ is a sequence with imbalance $ 1 $ , which is the minimum imbalance among sequences satisfying the condition. ### Constraints - $ 1 \leq N \leq 20 $ - $ 0 \leq K \leq 10^9 $ - $ N $ and $ K $ are integers.