#include <bits/stdc++.h> 
using namespace std;
#define ll long long
int main(){
    ll t;
    cin>>t;
    while(t--){
        ll n,c=0,sum=0,k;
        cin>>n>>k;
        n=n-k+3;
        if(n%4==0)
     {
      cout<<n/2<<" "<<n/4<<" "<<n/4<<" ";
      for(ll i=0;i<k-3;i++)
      cout<<1<<" ";
      cout<<endl;
      continue;
    }
   if(n%3==0)
     {
      cout<<n/3<<" "<<n/3<<" "<<n/3<<" ";
      for(ll i=0;i<k-3;i++)
      cout<<1<<" ";
      cout<<endl;
      continue;
    }
       if(n%2==0)
     {
      cout<<n/2 - 1<<" "<<n/2 - 1<<" "<<2<<" ";
      for(ll i=0;i<k-3;i++)
      cout<<1<<" ";
      cout<<endl;
      continue;
    }
      cout<<n/2<<" "<<n/2<<" "<<1<<" ";
      for(ll i=0;i<k-3;i++)
      cout<<1<<" ";
      cout<<endl;
    
        
    }
    return 0;
}