#include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main() {
    int t;
    cin>>t;
    while(t--)
    {
        int n,k;
        cin>>n>>k;
        int temp=n-(k-3);
        if(temp%2==0)
        {
            int num=temp/2;
            if(num%2==0)
            {
                int half=num/2;
                cout<<num<<" "<<half<<" "<<half<<" ";
            }
            else
            {
                int half=num-1;
                cout<<half<<" "<<half<<" "<<2<<" ";
            }
        }
        else
        {
            int num=temp/2;
            cout<<num<<" "<<num<<" "<<1<<" ";
        }
        for(int i=0;i<k-3;i++) cout<<1<<" ";
        cout<<endl;
    }
}