rt
#include<bits/stdc++.h>
#define int long long
using namespace std;
int t,s,m;
int read(){
int s=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-') f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
s=s*10+ch-'0';
ch=getchar();
}
return s*f;
}
inline void write(int x){
static char buf[20];
static int len=-1;
if(x<0)putchar('-'),x=-x;
do buf[++len]=x%10,x/=10;while(x);
while(len>=0)putchar(buf[len--]+'0');
putchar(' ');
}
signed main(){
t=read();
while(t--){
s=read(),m=read();
if(s&1||m==1)puts("-1");
else {
write(2);
write(s>>1);
write(s>>1);
puts("");
}
}
return 0;
}