Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js

B. Missing Subsequence Sum
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given two integers n and k. Find a sequence a of non-negative integers of size at most 25 such that the following conditions hold.

  • There is no subsequence of a with a sum of k.
  • For all 1vn where vk, there is a subsequence of a with a sum of v.

A sequence b is a subsequence of a if b can be obtained from a by the deletion of several (possibly, zero or all) elements, without changing the order of the remaining elements. For example, [5,2,3] is a subsequence of [1,5,7,8,2,4,3].

It can be shown that under the given constraints, a solution always exists.

Input

The first line of the input contains a single integer t (1t1000) — the number of test cases. The description of the test cases follows.

Each test case consists of a single line containing two integers n and k (2n106, 1kn) — the parameters described above.

It is guaranteed that the sum of n over all test cases does not exceed 107.

Output

The first line of output for each test case should contain a single integer m (1m25) — the size of your chosen sequence.

The second line of output for each test case should contain m integers ai (0ai109) — the elements of your chosen sequence.

If there are multiple solutions, print any.

Example
Input
5
2 2
6 1
8 8
9 3
10 7
Output
1
1
5
2 3 4 5 6
7
1 1 1 1 1 1 1
4
7 1 4 1
4
1 2 8 3
Note

In the first example, we just need a subsequence that adds up to 1, but not one that adds up to 2. So the array a=[1] suffices.

In the second example, all elements are greater than k=1, so no subsequence adds up to 1. Every other integer between 1 and n is present in the array, so there is a subsequence of size 1 adding up to each of those numbers.