#include <bits/stdc++.h>
#define int long long 
#define endl "\n"
using namespace std;

signed main() 
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,k;
        cin>>n>>k;
        for(int i=0;i<k-3;i++)
        { cout<<"1 ";
        
            n--;
        }
        if(n%2==1)
        {
            cout<<"1 "<<(n/2)<<" "<<(n/2);
        }
        else 
         {
             if(n/2%2==0)
             cout<<(n/2)<<" "<<((n/2)/2)<<" "<<((n/2)/2);
             else {
             cout<<((n-1)/2)<<" "<<((n-1)/2)<<" "<<(n-2*((n-1)/2));
            
                 
                 
             }
         }
        cout<<endl;
    }
	return 0;
}
