Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define fast()(ios_base::sync_with_stdio(0),cin.tie(NULL));
- int main()
- {
- ll t ;
- cin>> t;
- while(t--)
- {
- ll n, k;
- cin>>n>>k;
- set<ll>s;
- for(ll i = 0; i<n; i++)
- {
- ll x;
- cin >> x;
- s.insert(x);
- }
- //s.unique();
- //cout<<"Test "<< s.size()<<endl;
- if(s.size()>k)
- {
- cout<<"-1"<<endl;
- continue;
- }
- else
- {
- cout<<n*k<<endl;
- for(ll i=0 ; i<n; i++)
- {
- for(auto x: s)cout<<x<<" ";
- for(ll i =0 ;i<k-s.size();i++)
- {
- cout<<"1 ";
- }
- }
- cout<<endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement