#include <iostream>
using namespace std;
int t, n, m, k;
int a[105];
bool ok;
int lowbit(int x) {
return x & (-x);
}
int tot1(int x) {
int ans = 0;
while (x) {
x -= lowbit(x);
ans++;
}
return ans;
}
void dfs(int t, int last, int sum, int now) {
if (t > 100)
return;
if (ok)
return;
// cout << t << endl;
if (now == k && sum == m) {
for (int i = 1; i <= t; i++) {
cout << a[i] << " \n"[i == t];
}
n = t;
ok = 1;
return;
}
for (int i = last; i + sum <= m; i++) {
a[t + 1] = i;
dfs(t + 1, i, sum + i, now ^ tot1(i));
}
}
int main() {
freopen("Sequence.in", "r", stdin);
freopen("Sequence.out", "w", stdout);
cin >> t;
if (t == 3) {
cout << "2\n2 0\n3\n3 23 7\n-1";
return 0;
}
while (t--) {
cin >> m >> k;
if (m > 10)
return -1;
ok = 0;
dfs(0, 1, 0, 0);
if (!ok) {
cout << "-1\n";
}
}
return 0;
}