#include <bits/stdc++.h>
using i64 = long long;
void solve() {
int n, m;
std::cin >> n >> m;
std::multiset<int> f1, f2;
std::vector<int> b(m);
for (int i = 0; i < n; i++) {
int x;
std::cin >> x;
f1.emplace(x);
}
for (int i = 0; i < m; i++) {
std::cin >> b[i];
}
i64 sum = 0;
int cnt = m - 1;
for (auto x : std::ranges::views::reverse(f1)) {
if (cnt == -1) {
break;
}
f2.emplace(x);
if (x > b[cnt]) {
std::cout << "-1\n";
return;
}
sum += b[cnt--] - x;
}
if (sum > n - m) {
std::cout << "-1\n";
return;
}
cnt = n - m - sum;
std::vector<int> ans;
while (cnt) {
int x = *f1.begin();
f1.erase(f1.begin());
f1.emplace(x + 1);
f1.erase(f1.begin());
ans.push_back(x);
if (x + 1 > *f2.begin()) {
f2.erase(f2.begin());
f2.emplace(x + 1);
sum -= 1;
if (sum < 0) {
std::cout << "-1\n";
return;
}
} else {
cnt -= 1;
}
}
int r = m - 1;
while (r != -1) {
if (f1.empty() || b[r] < *f1.rbegin()) {
std::cout << "-1\n";
return;
}
while (*f1.rbegin() != b[r]) {
if (f1.size() == 1) {
std::cout << "-1\n";
return;
}
int x = *f1.rbegin();
ans.push_back(x);
f1.erase(std::prev(f1.end()));
f1.emplace(x + 1);
f1.erase(f1.begin());
}
r--;
f1.erase(std::prev(f1.end()));
}
if (int(f1.size()) != 0) {
std::cout << "-1\n";
return;
}
std::cout << int(ans.size()) << "\n";
for (auto x : ans) {
std::cout << x << " ";
}
std::cout << "\n";
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
std::cin >> t;
while (t--) {
solve();
}
return 0;
}