package main

import (
	"os"
	"io/ioutil"
	"bytes"
	"fmt"
)

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)

	var n, m int
	fmt.Fscanf(reader, "%d %d\n", &n, &m)
	cord := make([]int, n + m)
	rider := make([]int, 0, n)
	taxi := make([]int, 0, m)
	ans := make([]int, m)
	for i := 0;i < n + m;i ++ {
		if i == n + m - 1 {
			fmt.Fscanf(reader, "%d\n", &cord[i])
		} else {
			fmt.Fscanf(reader, "%d ", &cord[i])
		}
	}
	for i := 0;i < n + m;i ++ {
		var b int
		if i == n + m - 1 {
			fmt.Fscanf(reader, "%d\n", &b)
		} else {
			fmt.Fscanf(reader, "%d ", &b)
		}
		if b == 1 {
			taxi = append(taxi, cord[i])
		} else {
			rider = append(rider, cord[i])
		}
	}

	for i, j := 0, 0; i < n; {
		if rider[i] < taxi[0] {
			ans[0] ++
			i ++
		} else if rider[i] > taxi[m - 1] {
			ans[m - 1] ++
			i ++
		} else if rider[i] < taxi[j] {
			i ++
		} else if rider[i] > taxi[j + 1] {
			j ++
		} else {
			if rider[i] - taxi[j] <= taxi[j + 1] - rider[i] {
				ans[j] ++
			} else {
				ans[j + 1] ++
			}
			i ++
		}
	}
	for i := 0;i < m;i ++ {
		fmt.Printf("%d ", ans[i])
	}
}

// Codeforces 1075 B Taxi drivers and Lyft train
package main

import (
	"bufio"
	"fmt"
	"strings"
	"strconv"
	"os"
	"sort"
)
var in *bufio.Reader

func readFive() (int,int,int,int,int) {
	var a [5]int
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for i:=0; i<len(ss); i++ {
		a[i], err = strconv.Atoi(ss[i])
		if err != nil {
			fmt.Println("n atoi failure", err)
			panic(err)
		}
	}
	return a[0],a[1],a[2],a[3],a[4]
}

func readLineNumbs(n int) []int {
	a := make([]int, n)
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for j:=0; j<n; j++ {
		aa,err := strconv.Atoi(ss[j])
		if err != nil {
			fmt.Println("aa conv failed", err)
			panic(err)
		}
		a[j] = aa
	}
	return a
}

var n,m,nm int
var x []int
var t []int
var res []int
var cntr []int

func readData() {
	in = bufio.NewReader(os.Stdin)
	n,m,_,_,_ = readFive()
	nm = n + m
	x = readLineNumbs(nm)
	t = readLineNumbs(nm)
	res = make([]int, m)
}

// inverted x, binary search
func pos2idx(pos int) int {
	idx := sort.Search(nm, func(i int) bool { return x[i] >= pos })
	//fmt.Println("pos2idx(", pos, ") ret ", idx)
	return idx
}

// riders in interval fro i0 to i1 (inclusive)
func ridersInterval(i0 int, i1 int) int {
	nrid := cntr[i1+1] - cntr[i0]
	//fmt.Printf("ridersInterval(%d, %d) ret %d\n", i0,i1,nrid)
	return nrid
}

func solve() {
	cnt := 0
	itax := 0
	cntr = make([]int, nm+1)
	tidx := make([]int, m)
	for i:=0; i<nm; i++ {
		cntr[i] = cnt
		if t[i]==0 {
			cnt += 1
		} else {
			tidx[itax] = i
			itax++
		}
	}
	cntr[nm] = cnt
	// counting res
	for it:=0; it<m; it++ {
		if it==m-1 {
			// last interval, only add to last taxist
			res[it] += ridersInterval(tidx[it], nm-1)
		} else {
			// middle, divide interval it, it+1 and add to 2 taxists
			x0,x1 := x[tidx[it]], x[tidx[it+1]]
			midpos := (x0 + x1) / 2
			mididx := pos2idx(midpos)
			//fmt.Printf("x0,x1 = %d %d\n", x0,x1)
			midpos = x[mididx]
			//fmt.Printf("midpos,mididx = %d %d\n", midpos,mididx)
			if (midpos-x0) > (x1-midpos) {
				// added to second
				mididx--
			}
			m0 := mididx
			m1 := mididx+1
			//fmt.Printf("m0,m1 = %d %d\n", m0,m1)
			res[it] += ridersInterval(tidx[it], m0)
			res[it+1] += ridersInterval(m1, tidx[it+1])
		}
		if it==0 {
			// first interval, only add to first taxist
			res[it] += ridersInterval(0, tidx[it])
		}
	}
}

func printRes() {
	for i :=0; i<m; i++ {
		fmt.Print(res[i], " ")
	}
	fmt.Println("")
}

func main() {
	readData()
	solve()
	printRes()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()
	var n, m int
	scanf("%d %d\n", &n, &m)
	loc := make([]int, n+m)
	ist := make([]int, n+m)
	rt := make([]int, n+m)
	ans := make([]int, n+m)

	for i := 0; i < n+m; i++ {
		scanf("%d ", &loc[i])
	}
	//fmt.Println("hic")
	scanf("\n")
	//fmt.Println("hic")
	for i := 0; i < n+m; i++ {
		scanf("%d ", &ist[i])
	}
	//fmt.Println("hic")

	lst := -1

	for i := n + m - 1; i >= 0; i-- {
		if ist[i] == 1 {
			lst = i
		} else {
			rt[i] = lst
		}
	}

	cur := -1

	for i := 0; i < n+m; i++ {
		if ist[i] == 1 {
			cur = i
		} else {
			if cur != -1 && rt[i] != -1 {
				if loc[i]-loc[cur] <= loc[rt[i]]-loc[i] {
					ans[cur]++
				} else {
					ans[rt[i]]++
				}
			} else if cur != -1 {
				ans[cur]++
			} else {
				ans[rt[i]]++
			}
		}
	}

	for i := 0; i < n+m; i++ {
		if ist[i] == 1 {
			printf("%d ", ans[i])
		}
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func init() {
	scanner.Split(bufio.ScanWords)
}

func scanString() string {
	scanner.Scan()
	return scanner.Text()
}

func scanInt64() int64 {
	scanner.Scan()
	v, _ := strconv.ParseInt(scanner.Text(), 10, 64)
	return v
}

func scanInt() int {
	scanner.Scan()
	v, _ := strconv.Atoi(scanner.Text())
	return v
}

func scanInts(n int) []int {
	l := make([]int, n)
	for i := 0; i < n; i++ {
		scanner.Scan()
		l[i], _ = strconv.Atoi(scanner.Text())
	}

	return l
}

func scanInts64(n int64) []int64 {
	l := make([]int64, n)
	for i := int64(0); i < n; i++ {
		scanner.Scan()
		l[i], _ = strconv.ParseInt(scanner.Text(), 10, 64)
	}

	return l
}

func scanBool() bool {
	scanner.Scan()
	v, _ := strconv.ParseInt(scanner.Text(), 10, 64)
	return v == 1
}

func scanBools(n int64) []bool {
	l := make([]bool, n)
	for i := int64(0); i < n; i++ {
		scanner.Scan()
		v, _ := strconv.ParseInt(scanner.Text(), 10, 64)
		l[i] = v == 1
	}

	return l
}

func main() {
	n, m := scanInt64(), scanInt64()
	POS, TAXI := make([]int64, n+m+2), make([]bool, n+m+2)

	POS[0], POS[n+m+1] = -2*10e9, 2*10e9
	for i := int64(1); i <= n+m; i++ {
		POS[i] = scanInt64()
	}

	for i := int64(1); i <= n+m; i++ {
		TAXI[i] = scanBool()
	}

	L := make([]int64, n+m+2)
	R := make([]int64, n+m+2)

	L[0] = 0
	R[n+m+1] = n + m + 1

	for i := int64(1); i <= n+m; i++ {
		if !TAXI[i] {
			L[i] = L[i-1]
			continue
		}

		L[i] = i
	}

	for i := n + m; i > 0; i-- {
		if !TAXI[i] {
			R[i] = R[i+1]
			continue
		}

		R[i] = i
	}

	RES := make([]int64, n+m+2)
	for i := int64(1); i <= n+m; i++ {
		if TAXI[i] {
			continue
		}

		distLeft := POS[i] - POS[L[i]]
		distRight := POS[R[i]] - POS[i]

		if distRight < distLeft {
			RES[R[i]]++
		} else {
			RES[L[i]]++
		}
	}

	for i := int64(1); i <= n+m; i++ {
		if TAXI[i] {
			fmt.Println(RES[i])
		}
	}
}

func abs(a int64) int64 {
	if a >= 0 {
		return a
	}

	return -a
}

func min(a, b int64) int64 {
	if a < b {
		return a
	}

	return b
}

package main

import (
	"fmt"
	"bufio"
	"os"
)

type FlagStatus struct {
	flag int
	left int
	right int
}
func Slove(left int ,right int ,k int,pos []int)int{
	if left==-1{
		return right
	}
	if right==-1{
		return left
	}
	if (pos[right]-pos[k]<pos[k]-pos[left]){
		return  right
	}else{
		return left
	}
}
var in = bufio.NewReaderSize(os.Stdin, 2<<16)
func main(){
	var x,y int
	var t int
	fmt.Fscan(in, &x,&y)
	pos:=[]int{}
	ans:=[]int{}
    for index:=0;index<x+y;index++{
    	fmt.Fscan(in,&t)
    	pos=append(pos,t)
    	ans=append(ans,0)
	}
	flag:=[]FlagStatus{}
	for index:=0;index<x+y;index++{
		fmt.Fscan(in,&t)
		flag=append(flag,FlagStatus{flag:t})
	}

	left_init:=-1
	for index:=0;index<x+y;index++{
		if flag[index].flag==1{
			left_init=index
			continue
		}
		flag[index].left=left_init
	}
	right_init:=-1
	for index:=x+y-1;index>=0;index--{
		if flag[index].flag==1{
			right_init=index
			continue
		}
		flag[index].right=right_init
	}

	for k,v:=range flag{
		//fmt.Println("flag",v.flag,"left",v.left,"right",v.right)
		if v.flag==1{
			continue
		}
		t:=Slove(v.left,v.right,k,pos)
		ans[t]++
	}
	kong:=0
	for k,v:=range ans{
		if flag[k].flag==1{
			if kong==0{
				fmt.Print(v)
				kong=1
			}else{
				fmt.Print(" ",v)
			}
		}
	}
	fmt.Print("\n")

}

// Codeforces 1075 B Taxi drivers and Lyft train
package main

import (
	"bufio"
	"fmt"
	"strings"
	"strconv"
	"os"
	"sort"
)
var in *bufio.Reader

func readFive() (int,int,int,int,int) {
	var a [5]int
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for i:=0; i<len(ss); i++ {
		a[i], err = strconv.Atoi(ss[i])
		if err != nil {
			fmt.Println("n atoi failure", err)
			panic(err)
		}
	}
	return a[0],a[1],a[2],a[3],a[4]
}

func readLineNumbs(n int) []int {
	a := make([]int, n)
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for j:=0; j<n; j++ {
		aa,err := strconv.Atoi(ss[j])
		if err != nil {
			fmt.Println("aa conv failed", err)
			panic(err)
		}
		a[j] = aa
	}
	return a
}

var n,m,nm int
var x []int
var t []int
var res []int
var cntr []int

func readData() {
	in = bufio.NewReader(os.Stdin)
	n,m,_,_,_ = readFive()
	nm = n + m
	x = readLineNumbs(nm)
	t = readLineNumbs(nm)
	res = make([]int, m)
}

// inverted x, binary search
func pos2idx(pos int) int {
	idx := sort.Search(nm, func(i int) bool { return x[i] >= pos })
	//fmt.Println("pos2idx(", pos, ") ret ", idx)
	return idx
}

// riders in interval fro i0 to i1 (inclusive)
func ridersInterval(i0 int, i1 int) int {
	nrid := cntr[i1+1] - cntr[i0]
	//fmt.Printf("ridersInterval(%d, %d) ret %d\n", i0,i1,nrid)
	return nrid
}

func solve() {
	cnt := 0
	itax := 0
	cntr = make([]int, nm+1)
	tidx := make([]int, m)
	for i:=0; i<nm; i++ {
		cntr[i] = cnt
		if t[i]==0 {
			cnt += 1
		} else {
			tidx[itax] = i
			itax++
		}
	}
	cntr[nm] = cnt
	// counting res
	for it:=0; it<m; it++ {
		if it==m-1 {
			// last interval, only add to last taxist
			res[it] += ridersInterval(tidx[it], nm-1)
		} else {
			// middle, divide interval it, it+1 and add to 2 taxists
			midpos := (x[tidx[it]] + x[tidx[it+1]]) / 2
			mididx := pos2idx(midpos)
			res[it] += ridersInterval(tidx[it], mididx)
			res[it+1] += ridersInterval(mididx+1, tidx[it+1])
		}
		if it==0 {
			// first interval, only add to first taxist
			res[it] += ridersInterval(0, tidx[it])
		}
	}
}

func printRes() {
	for i :=0; i<m; i++ {
		fmt.Print(res[i], " ")
	}
	fmt.Println("")
}

func main() {
	readData()
	solve()
	printRes()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()
	var n, m int
	scanf("%d %d\n", &n, &m)
	loc := make([]int, n+m)
	ist := make([]int, n+m)
	rt := make([]int, n+m)
	ans := make([]int, n+m)

	for i := 0; i < n+m; i++ {
		scanf("%d ", &loc[i])
	}
	//fmt.Println("hic")
	scanf("\n")
	//fmt.Println("hic")
	for i := 0; i < n+m; i++ {
		scanf("%d ", &ist[i])
	}
	//fmt.Println("hic")

	lst := -1

	for i := n + m - 1; i >= 0; i-- {
		if ist[i] == 1 {
			lst = i
		} else {
			rt[i] = lst
		}
	}

	cur := -1

	for i := 0; i < n+m; i++ {
		if ist[i] == 1 {
			cur = i
		} else {
			if cur != -1 && rt[i] != -1 {
				if i-cur >= rt[i]-i {
					ans[cur]++
				} else {
					ans[rt[i]]++
				}
			} else if cur != -1 {
				ans[cur]++
			} else {
				ans[rt[i]]++
			}
		}
	}

	for i := 0; i < n+m; i++ {
		if ist[i] == 1 {
			printf("%d ", ans[i])
		}
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()
	var n, m int
	scanf("%d %d\n", &n, &m)
	loc := make([]int, n+m)
	ist := make([]int, n+m)
	rt := make([]int, n+m)
	ans := make([]int, n+m)

	for i := 0; i < n+m; i++ {
		scanf("%d ", &loc[i])
	}
	//fmt.Println("hic")
	//scanf("\n")
	//fmt.Println("hic")
	for i := 0; i < n+m; i++ {
		scanf("%d ", &ist[i])
	}
	//fmt.Println("hic")

	lst := -1

	for i := n + m - 1; i >= 0; i-- {
		if ist[i] == 1 {
			lst = i
		} else {
			rt[i] = lst
		}
	}

	cur := -1

	for i := 0; i < n+m; i++ {
		if ist[i] == 1 {
			cur = i
		} else {
			if cur != -1 && rt[i] != -1 {
				if i-cur >= rt[i]-i {
					ans[cur]++
				} else {
					ans[rt[i]]++
				}
			} else if cur != -1 {
				ans[cur]++
			} else {
				ans[rt[i]]++
			}
		}
	}

	for i := 0; i < n+m; i++ {
		if ist[i] == 1 {
			printf("%d ", ans[i])
		}
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

type citizen struct {
	pos  int64
	taxi bool
}

func main() {
	var (
		n, m int64
	)

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	scanner.Scan()
	n, _ = strconv.ParseInt(scanner.Text(), 10, 64)

	scanner.Scan()
	m, _ = strconv.ParseInt(scanner.Text(), 10, 64)

	l := make([]citizen, n+m)

	for i := 0; i < len(l); i++ {
		scanner.Scan()
		l[i].pos, _ = strconv.ParseInt(scanner.Text(), 10, 64)
	}

	for i := 0; i < len(l); i++ {
		scanner.Scan()
		st, _ := strconv.ParseInt(scanner.Text(), 10, 64)
		l[i].taxi = st == 1
	}

	ll := make([]citizen, n+m)
	copy(ll, l)
	sort.Slice(ll, func(i, j int) bool {
		return ll[i].pos < ll[j].pos
	})

	// for i := 0; i < len(l); i++ {
	// 	s := "walker"
	// 	if l[i].taxi {
	// 		s = "TAXI"
	// 	}

	// 	fmt.Println(l[i].pos, " is ", s)
	// }

	a := make(map[int64]int64)
	var cnt int64 = 0
	var prev int64 = -1
	for i := int64(0); i < n+m; i++ {
		pos := ll[i].pos
		taxi := ll[i].taxi

		if !taxi {
			cnt++
			continue
		}

		if prev == -1 {
			a[pos] = cnt
			cnt = 0
			prev = pos

			continue
		}

		right := int64(cnt / 2)
		left := cnt - right

		a[prev] += left
		a[pos] = right

		prev = pos

		cnt = 0
	}

	a[prev] += cnt

	for i := 0; i < len(l); i++ {
		if !l[i].taxi {
			continue
		}

		fmt.Println(a[l[i].pos])
	}
}

func abs(a int64) int64 {
	if a >= 0 {
		return a
	}

	return -a
}

func min(a, b int64) int64 {
	if a > b {
		return a
	}

	return b
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

type citizen struct {
	pos  int64
	taxi bool
}

func main() {
	var (
		n, m int64
	)

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	scanner.Scan()
	n, _ = strconv.ParseInt(scanner.Text(), 10, 64)

	scanner.Scan()
	m, _ = strconv.ParseInt(scanner.Text(), 10, 64)

	l := make([]citizen, n+m)

	for i := 0; i < len(l); i++ {
		scanner.Scan()
		l[i].pos, _ = strconv.ParseInt(scanner.Text(), 10, 64)
	}

	for i := 0; i < len(l); i++ {
		scanner.Scan()
		st, _ := strconv.ParseInt(scanner.Text(), 10, 64)
		l[i].taxi = st == 1
	}

	sort.Slice(l, func(i, j int) bool {
		return l[i].pos < l[j].pos
	})

	// for i := 0; i < len(l); i++ {
	// 	s := "walker"
	// 	if l[i].taxi {
	// 		s = "TAXI"
	// 	}

	// 	fmt.Println(l[i].pos, " is ", s)
	// }

	var a []int64
	var cnt int64 = 0
	for i := 0; i < len(l); i++ {
		if !l[i].taxi {
			cnt++
			continue
		}

		if len(a) == 0 {
			a = append(a, cnt)
			cnt = 0

			continue
		}

		right := int64(cnt / 2)
		left := cnt - right

		a[len(a)-1] += left
		a = append(a, right)

		cnt = 0
	}

	a[len(a)-1] += cnt

	for i := 0; i < len(a); i++ {
		fmt.Println(a[i])
	}
}

func abs(a int64) int64 {
	if a >= 0 {
		return a
	}

	return -a
}

func min(a, b int64) int64 {
	if a > b {
		return a
	}

	return b
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

var reader io.Reader
var scanner *bufio.Scanner

func Init(io io.Reader, max_token_size int) {
	reader = bufio.NewReader(io)
	scanner = bufio.NewScanner(reader)
	// max token size
	scanner.Split(bufio.ScanWords)
	scanner.Buffer([]byte{}, max_token_size)
}

func stderr(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
}

func die(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
	os.Exit(1)
}

func NextInt() int {
	bytes := NextBytes()
	i, err := Atoi(bytes)
	if err != nil {
		die(err)
	}
	return i
}
func NextInt64() int64 {
	bytes := NextBytes()
	i, err := Atoi64(bytes)
	if err != nil {
		die(err)
	}
	return i
}

func NextBytes() []byte {
	if !scanner.Scan() {
		die(scanner.Err())
	}
	bytes := scanner.Bytes()
	copied := make([]byte, len(bytes))
	copy(copied, bytes)
	return copied
}

func Atoi(b []byte) (int, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n, nil
	}
	return n, nil
}

func Atoi64(b []byte) (int64, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	var n int64
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int64(v-'0')
	}
	if neg {
		return -n, nil
	}
	return n, nil
}

func ExtendByteArray(a []byte, size int) []byte {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]byte, size-len(a))...)
	}
}

func ExtendIntArray(a []int, size int) []int {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]int, size-len(a))...)
	}
}

func reverseInts(a []int) {
	for l, r := 0, len(a)-1; l < r; l, r = l+1, r-1 {
		a[l], a[r] = a[r], a[l]
	}
}

func unique(a []int) int {
	newLen := 0
	n := len(a)
	for i := 0; i < n; i++ {
		if newLen == 0 || a[i] != a[newLen-1] {
			a[newLen] = a[i]
			newLen++
		}
	}
	return newLen
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	inf := os.Stdin
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	// inf, err := os.Open("a.in")
	// if err != nil {
	// 	die(err)
	// }
	// out, err := os.Create("a.out")
	// if err != nil {
	// 	die(err)
	// }
	// defer out.Close()
	Init(inf, 1000010)

	T := NextInt()

	a := make([]int, 100)
	b := make([]int, 100)
	res := make([]int, 100000)

	for t := 0; t < T; t++ {
		n, k := NextInt(), NextInt()

		for i := 0; i < n; i++ {
			a[i] = NextInt()
			b[i] = a[i]
		}
		sort.Ints(b[:n])
		newlen := unique(b[:n])

		if newlen > k {
			fmt.Fprintln(out, -1)
			continue
		}

		for i := newlen; i < k; i++ {
			b[i] = 1
		}

		good := true
		l := 0
		for i, j := 0, 0; good && i < n; i++ {
			ok := false
			// stderr("i", i, "j", j, "ai", a[i], "aj", a[j], "b:", b[:l])
			for t := 0; !ok && t < k; t++ {
				// stderr("t=", t)
				if b[j] != a[i] {
					res[l] = b[j]
					j++
					l++
				} else {
					res[l] = a[i]
					j++
					l++
					ok = true
				}
				if j == k {
					j = 0
				}
			}
			good = ok
		}

		if !good {
			fmt.Fprintln(out, -1)
			continue
		}
		fmt.Fprintln(out, l)
		for i := 0; i < l; i++ {
			fmt.Fprint(out, res[i], " ")
		}
		fmt.Fprintln(out)
	}

}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

var pre = make([]int64,31)

func doPre(){
	pre[0] = 1
	for i :=1 ;i< 31;i++{
		pre[i] = pre[i-1] * 2
	}
}
func solve(n int) {
	var max,min int64 = 0,0
	max += pre[n]
	for i := 1;i < n;i++{
		if i <= n/2 -1 {
			max += pre[i]
		}else{
			min += pre[i]
		}
	}
	fmt.Println(math.Abs(float64(max) - float64(min)))
}

func main() {
	var t int
	scanf("%d\n",&t)
	for i:=0;i<t;i++{
		var n,k int
		scanf("%d %d\n",&n,&k)
		beautyArray := make([]int,n)
		countMap := make(map[int]int)
		for j:=0;j<n;j++{
			if j == n-1 {
				scanf("%d\n",&beautyArray[j])
			}else {
				scanf("%d ", &beautyArray[j])
			}
			countMap[beautyArray[j]]++
		}
		if len(countMap) > k{
			fmt.Println("-1")
		}else{
			result := make([]int,n)
			var index int = 0
			for k,_ := range countMap{
				result[index] = k
				index++
			}
			for i:=index;i<k;i++{
				result[i] = result[0]
			}
			fmt.Println(n * k)
			for i:=0;i<n;i++{
				for j:=0;j<k;j++{
					if i == 0 && j == 0 {
						fmt.Print(result[j])
					}else {
						fmt.Print(" ", result[j])
					}
				}
				if i == n-1 {
					fmt.Println()
				}
			}
		}
	}
}

package main

import (
	"fmt"
	"bufio"
	"os"
	"sort"
)

func main() {
    in := bufio.NewReader(os.Stdin)
    out := bufio.NewWriter(os.Stdout)
    defer out.Flush()
	noEx := 0
	fmt.Fscan(in, &noEx)
	for ; noEx > 0; noEx-- {
		n, k := 0, 0
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &k)
		nums := make([]int, n)
		nSet := make(map[int]bool)
		var b []int
		for i:=0; i<n; i++ {fmt.Fscan(in, &nums[i]); nSet[nums[i]] = true}
		if len(nSet) > k {fmt.Fprint(out, -1); fmt.Fprint(out, "\n"); continue}
		var rec []int
		for v, _ := range nSet {rec = append(rec, v)}
		var comp []int
		sort.Ints(rec)
		for cnt := 0; cnt<k; cnt++ {
			comp = append(comp, rec[cnt%len(nSet)])
		}
		for _, _ = range nums {
			for _, n := range comp {b = append(b, n)}
		}
		fmt.Fprint(out, len(b))
		fmt.Fprint(out, "\n")
		for k, v := range b {
			fmt.Fprint(out, v)
			if k != len(b)-1 {fmt.Fprint(out, " ")}
		}
		fmt.Fprint(out, "\n")
	}
}

package main

import  (
	"bufio"
	"fmt"
	"os"
)

func unique(intSlice []int) []int {
    keys := make(map[int]bool)
    list := []int{}
    for _, entry := range intSlice {
        if _, value := keys[entry]; !value {
            keys[entry] = true
            list = append(list, entry)
        }
    }
    return list
}

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for t1 := 0; t1 < t; t1++ {
		var n, k int
		scanf("%d %d\n", &n, &k)
		a := make([]int, n)

		// fmt.Print(n,k)
		for i :=0; i<n; i++ {
			if i == n-1 {
				scanf("%d\n", &a[i])
			} else {
				scanf("%d ", &a[i])
			}
		}

		uniqueSlice := unique(a)

		if len(uniqueSlice) > k {
			fmt.Println("-1")
		} else {
			var lett int
			lett = len(uniqueSlice)
			for i :=0; i<(k-lett); i++ {
				uniqueSlice = append(uniqueSlice, 1)
			}

			fmt.Println(n*k)
			for i:=0; i < n; i++ {
				for j:=0; j < k; j++ {
					if i == n-1 && j == k-1 {
						fmt.Print(uniqueSlice[j], "\n")

					} else {
						fmt.Print(uniqueSlice[j], " ")
					}
				}
			}
		}

	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n, k := reader.NextInt64(), reader.NextInt64()
		aa := make([]int64, n)
		for i := int64(0); i < n; i++ {
			aa[i] = reader.NextInt64()
		}
		res := sol(aa, k)
		if res == nil {
			writer.Printf("-1\n")
		} else {
			writer.Printf("%d\n", len(res))
			for _, num := range res {
				writer.Printf("%d ", num)
			}
			writer.Printf("\n")
		}
	}
}

func sol(aa []int64, k int64) []int64 {
	u := map[int64]bool{}
	for i := int64(0); i < int64(len(aa)); i++ {
		u[aa[i]] = true
	}
	if int64(len(u)) > k {
		return nil
	}
	rep := []int64{}
	for i := range u {
		rep = append(rep, i)
	}
	for i := int64(len(rep)); i < k; i++ {
		rep = append(rep, 1) // random number
	}
	ret := []int64{}
	for i := 0; i < len(aa); i++ {
		ret = append(ret, rep...)
	}
	return ret
}

/*
URL:
https://codeforces.com/contest/1348/problem/B
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	t int
)

func main() {
	t = ReadInt()
	for i := 0; i < t; i++ {
		n, k := ReadInt2()
		A := ReadIntSlice(n)
		solve(n, k, A)
	}
}
func solve(n, k int, A []int) {
	if k == n {
		fmt.Println(n)
		fmt.Println(PrintIntsLine(A...))
		return
	}

	// 種類数をカウント
	kind := map[int]bool{}
	for i := 0; i < n; i++ {
		kind[A[i]] = true
	}
	if len(kind) > k {
		fmt.Println(-1)
		return
	}

	// memo := [105]int{}
	B := []int{}
OUTER:
	for {
		for key := range kind {
			B = append(B, key)
			if len(B) >= k {
				break OUTER
			}
		}
	}

	// for i := 0; i < k; i++ {
	// 	// memo[A[i]]++
	// 	B = append(B, A[i])
	// }

	// 未知のものが現れたら不可能
	// for i := k; i < n; i++ {
	// 	if memo[A[i]] == 0 {
	// 		fmt.Println(-1)
	// 		return
	// 	}
	// }

	backIdx := 0
	// frontIdx := k
	frontIdx := 0
	for frontIdx < n && backIdx < len(B) {
		if A[frontIdx] == B[backIdx] {
			B = append(B, A[frontIdx])
			// PrintfDebug("OK\n")

			frontIdx++
			backIdx++
		} else {
			B = append(B, B[backIdx])
			// PrintfDebug("Back: %d\n", B[backIdx])

			backIdx++
		}

		// PrintfDebug("%v\n", B)
	}

	fmt.Println(len(B))
	fmt.Println(PrintIntsLine(B...))
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	for t := ScanInt(); t > 0; t-- {
		n, k := ScanInt(), ScanInt()
		m := make(map[int]bool)
		for i := 0; i < n; i++ {
			m[ScanInt()] = true
		}

		solv(n, k, m)
	}

	close(O)
	oWg.Wait()
}

func solv(n, k int, m map[int]bool) {
	if k < len(m) {
		P(-1)
		return
	}
	P(n * k)
	sb := strings.Builder{}

	for key := range m {
		sb.WriteString(strconv.Itoa(key) + " ")
	}
	for i := 0; i < (k - len(m)); i++ {
		sb.WriteString("1 ")
	}

	P(strings.Repeat(sb.String(), n))
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanln(&t)

	var n []int = make([]int, t)
	var k []int = make([]int, t)
	var arr [][]int = make([][]int, t)
	var x int

	for i:=0; i< t ; i++ {
		fmt.Scan(&n[i])
		fmt.Scan(&k[i])

		for j :=0; j< n[i]; j++ {
			fmt.Scan(&x)
			arr[i] = append(arr[i], x)
		}
	}

	for i:=0; i< t ; i++ {
		k, v := getBeautiful(n[i], k[i], arr[i])
		if k == - 1 {
			fmt.Println(-1)
		} else {
			fmt.Println(k)
			print(v)
		}
	}
}

func print(arr []int) {
	l := len(arr)
	for i:=0; i< l; i++ {
		if i == l -1 {
			fmt.Println(arr[i])
		} else {
			fmt.Printf("%d ",arr[i])
		}
	}
}

func getBeautiful(n, k int, arr []int) (int, []int) {
	if n == k {
		result := append(arr, arr[:n-1]...)
		return (2*n -1), result
	}

	i := 0

	m := make(map[int]bool)
	for i =0; i< len(arr); i++ {
		m[arr[i]] = true
	}

	if len(m) > k {
		return -1, []int{}
	}

	for i=1; i <=n; i++ {
		if len(m) == k {
			break
		}
		m[i] = true
	}

	var tmp, result []int

	for k, _ := range m {
		tmp = append(tmp, k)
	}

	for i = 0; i< n; i++ {
		result = append(result, tmp...)
	}

	return len(result), result
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var reader io.Reader
var scanner *bufio.Scanner

func Init(io io.Reader, max_token_size int) {
	reader = bufio.NewReader(io)
	scanner = bufio.NewScanner(reader)
	// max token size
	scanner.Split(bufio.ScanWords)
	scanner.Buffer([]byte{}, max_token_size)
}

func stderr(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
}

func die(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
	os.Exit(1)
}

func NextInt() int {
	bytes := NextBytes()
	i, err := Atoi(bytes)
	if err != nil {
		die(err)
	}
	return i
}
func NextInt64() int64 {
	bytes := NextBytes()
	i, err := Atoi64(bytes)
	if err != nil {
		die(err)
	}
	return i
}

func NextBytes() []byte {
	if !scanner.Scan() {
		die(scanner.Err())
	}
	bytes := scanner.Bytes()
	copied := make([]byte, len(bytes))
	copy(copied, bytes)
	return copied
}

func Atoi(b []byte) (int, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n, nil
	}
	return n, nil
}

func Atoi64(b []byte) (int64, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	var n int64
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int64(v-'0')
	}
	if neg {
		return -n, nil
	}
	return n, nil
}

func ExtendByteArray(a []byte, size int) []byte {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]byte, size-len(a))...)
	}
}

func ExtendIntArray(a []int, size int) []int {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]int, size-len(a))...)
	}
}

func reverseInts(a []int) {
	for l, r := 0, len(a)-1; l < r; l, r = l+1, r-1 {
		a[l], a[r] = a[r], a[l]
	}
}

func unique(a []int) int {
	newLen := 0
	n := len(a)
	for i := 0; i < n; i++ {
		if newLen == 0 || a[i] != a[newLen-1] {
			a[newLen] = a[i]
			newLen++
		}
	}
	return newLen
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	inf := os.Stdin
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	// inf, err := os.Open("a.in")
	// if err != nil {
	// 	die(err)
	// }
	// out, err := os.Create("a.out")
	// if err != nil {
	// 	die(err)
	// }
	// defer out.Close()
	Init(inf, 1000010)

	T := NextInt()

	a := make([]int, 100)
	b := make([]int, 100000)

	for t := 0; t < T; t++ {
		n, k := NextInt(), NextInt()

		s := 0
		for i := 0; i < n; i++ {
			a[i] = NextInt()
			if i < k {
				s += a[i]
				b[i] = a[i]
			}
		}

		l := k
		good := true
		for i, j := k, 0; good && i < n; i++ {
			ok := false
			// stderr("i", i, "j", j, "ai", a[i], "aj", a[j], "b:", b[:l])
			for t := 0; !ok && t < k; t++ {
				// stderr("t=", t)
				if a[j] != a[i] {
					b[l] = a[j]
					j++
					l++
				} else {
					b[l] = a[i]
					j++
					l++
					ok = true
				}
				if j == k {
					j = 0
				}
			}
			good = ok
		}

		if !good {
			fmt.Fprintln(out, -1)
			continue
		}
		fmt.Fprintln(out, l)
		for i := 0; i < l; i++ {
			fmt.Fprint(out, b[i], " ")
		}
		fmt.Fprintln(out)
	}

}

package main

import  (
	"bufio"
	"fmt"
	"os"
)

func unique(intSlice []int) []int {
    keys := make(map[int]bool)
    list := []int{}
    for _, entry := range intSlice {
        if _, value := keys[entry]; !value {
            keys[entry] = true
            list = append(list, entry)
        }
    }
    return list
}

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for t1 := 0; t1 < t; t1++ {
		var n, k int
		scanf("%d %d\n", &n, &k)
		a := make([]int, n)

		// fmt.Print(n,k)
		for i :=0; i<n; i++ {
			if i == n-1 {
				scanf("%d\n", &a[i])
			} else {
				scanf("%d ", &a[i])
			}
		}

		uniqueSlice := unique(a)
		if len(uniqueSlice) > k {
			fmt.Println("-1")
		} else {
			for i :=0; i<(k-len(uniqueSlice)); i++ {
				uniqueSlice = append(uniqueSlice, 1)
			}

			fmt.Println(n*k)
			for i:=0; i < n; i++ {
				for j:=0; j < k; j++ {
					if i == n-1 && j == k-1 {
						fmt.Print("\n");
					} else {
						fmt.Print(uniqueSlice[j], " ")
					}
				}
			}
		}

	}
}

/*
URL:
https://codeforces.com/contest/1348/problem/B
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	t int
)

func main() {
	t = ReadInt()
	for i := 0; i < t; i++ {
		n, k := ReadInt2()
		A := ReadIntSlice(n)
		solve(n, k, A)
	}
}

func solve(n, k int, A []int) {
	memo := [105]int{}
	B := []int{}

	for i := 0; i < k; i++ {
		memo[A[i]]++
		B = append(B, A[i])
	}

	// 未知のものが現れたら不可能
	for i := k; i < n; i++ {
		if memo[A[i]] == 0 {
			fmt.Println(-1)
			return
		}
	}

	backIdx := 0
	frontIdx := k
	for frontIdx < n {
		if A[frontIdx] == B[backIdx] {
			B = append(B, A[frontIdx])
			// PrintfDebug("OK\n")

			frontIdx++
			backIdx++
		} else {
			B = append(B, B[backIdx])
			// PrintfDebug("Back: %d\n", B[backIdx])

			backIdx++
		}

		// PrintfDebug("%v\n", B)
	}

	fmt.Println(len(B))
	fmt.Println(PrintIntsLine(B...))
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1348/problem/B
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	t int
)

func main() {
	t = ReadInt()
	for i := 0; i < t; i++ {
		n, k := ReadInt2()
		A := ReadIntSlice(n)
		solve(n, k, A)
	}
}

// func solve(n, k int, A []int) {
// 	memo := [105]int{}

// 	for i := 0; i < k; i++ {
// 		memo[A[i]]++
// 	}

// 	// 未知のものが現れたら不可能
// 	for i := k; i < n; i++ {
// 		if memo[A[i]] == 0 {
// 			fmt.Println(-1)
// 			return
// 		}
// 	}

// 	B := []int{}
// 	for i := 0; i < k; i++ {
// 		B = append(B, A[i])
// 	}
// 	for i := k - 1; i < n; i++ {
// 		a := A[i]
// 		B = append(B, a)

// 		for j := 1; j <= n; j++ {
// 			num := memo[j]
// 			if a == j {
// 				num--
// 			}

// 			for l := 0; l < num; l++ {
// 				B = append(B, j)
// 			}
// 		}
// 	}

// 	fmt.Println(len(B))
// 	fmt.Println(PrintIntsLine(B...))
// }

func solve(n, k int, A []int) {
	if k == n {
		fmt.Println(n)
		fmt.Println(PrintIntsLine(A...))
		return
	}

	memo := [105]int{}
	B := []int{}

	for i := 0; i < k; i++ {
		memo[A[i]]++
		B = append(B, A[i])
	}

	// 未知のものが現れたら不可能
	for i := k; i < n; i++ {
		if memo[A[i]] == 0 {
			fmt.Println(-1)
			return
		}
	}

	backIdx := 0
	frontIdx := k
	for frontIdx < n && backIdx < len(B) {
		if A[frontIdx] == B[backIdx] {
			B = append(B, A[frontIdx])
			// PrintfDebug("OK\n")

			frontIdx++
			backIdx++
		} else {
			B = append(B, B[backIdx])
			// PrintfDebug("Back: %d\n", B[backIdx])

			backIdx++
		}

		// PrintfDebug("%v\n", B)
	}

	fmt.Println(len(B))
	fmt.Println(PrintIntsLine(B...))
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

/*
URL:
https://codeforces.com/contest/1348/problem/B
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	t int
)

func main() {
	t = ReadInt()
	for i := 0; i < t; i++ {
		n, k := ReadInt2()
		A := ReadIntSlice(n)
		solve(n, k, A)
	}
}

// func solve(n, k int, A []int) {
// 	memo := [105]int{}

// 	for i := 0; i < k; i++ {
// 		memo[A[i]]++
// 	}

// 	// 未知のものが現れたら不可能
// 	for i := k; i < n; i++ {
// 		if memo[A[i]] == 0 {
// 			fmt.Println(-1)
// 			return
// 		}
// 	}

// 	B := []int{}
// 	for i := 0; i < k; i++ {
// 		B = append(B, A[i])
// 	}
// 	for i := k - 1; i < n; i++ {
// 		a := A[i]
// 		B = append(B, a)

// 		for j := 1; j <= n; j++ {
// 			num := memo[j]
// 			if a == j {
// 				num--
// 			}

// 			for l := 0; l < num; l++ {
// 				B = append(B, j)
// 			}
// 		}
// 	}

// 	fmt.Println(len(B))
// 	fmt.Println(PrintIntsLine(B...))
// }

func solve(n, k int, A []int) {
	if k == n {
		fmt.Println(n)
		fmt.Println(PrintIntsLine(A...))
		return
	}

	memo := [105]int{}
	B := []int{}

	for i := 0; i < k; i++ {
		memo[A[i]]++
		B = append(B, A[i])
	}

	// 未知のものが現れたら不可能
	for i := k; i < n; i++ {
		if memo[A[i]] == 0 {
			fmt.Println(-1)
			return
		}
	}

	backIdx := 0
	frontIdx := k
	for frontIdx < n {
		if A[frontIdx] == B[backIdx] {
			B = append(B, A[frontIdx])
			// PrintfDebug("OK\n")

			frontIdx++
			backIdx++
		} else {
			B = append(B, B[backIdx])
			// PrintfDebug("Back: %d\n", B[backIdx])

			backIdx++
		}

		// PrintfDebug("%v\n", B)
	}

	fmt.Println(len(B))
	fmt.Println(PrintIntsLine(B...))
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	for t := ScanInt(); t > 0; t-- {
		n, k := ScanInt(), ScanInt()
		m := make(map[int]bool)
		for i := 0; i < n; i++ {
			m[ScanInt()] = true
		}

		solv(n, k, m)
	}

	close(O)
	oWg.Wait()
}

func solv(n, k int, m map[int]bool) {
	if k < len(m) {
		P(-1)
		return
	}
	P(n * k)
	sb := strings.Builder{}

	for q := 0; q < n; q++ {
		for key := range m {
			sb.WriteString(strconv.Itoa(key) + " ")
		}
		for i := 0; i < (k - len(m)); i++ {
			sb.WriteString( "1 ")
		}
	}
	P(sb.String())
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	for t := ScanInt(); t > 0; t-- {
		n, k := ScanInt(), ScanInt()
		m := make(map[int]bool)
		for i := 0; i < n; i++ {
			m[ScanInt()] = true
		}

		solv(n, k, m)
	}

	close(O)
	oWg.Wait()
}

func solv(n, k int, m map[int]bool) {
	if k < len(m) {
		P(-1)
		return
	}
	for q := 0; q < n; q++ {

		a := make([]int, 0, n*len(m))
		for k := range m {
			a = append(a, k)
		}
		for i := 0; i < (k - len(m)); i++ {
			a = append(a, 1)
		}
		P(n * k)
		P(SArr(a))
	}
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	for t := ScanInt(); t > 0; t-- {
		n, k := ScanInt(), ScanInt()
		m := make(map[int]bool)
		for i := 0; i < n; i++ {
			m[ScanInt()] = true
		}

		solv(n, k, m)
	}

	close(O)
	oWg.Wait()
}

func solv(n, k int, m map[int]bool) {
	if k < len(m) {
		P(-1)
		return
	}

	a := make([]int, 0, n*len(m))
	for k := range m {
		a = append(a, k)
	}
	for i := 0; i < (k - len(m)); i++ {
		a = append(a, 1)
	}
	P(n * k)
	P(SArr(a))
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanln(&t)

	var n []int = make([]int, t)
	var k []int = make([]int, t)
	var arr [][]int = make([][]int, t)
	var x int

	for i:=0; i< t ; i++ {
		fmt.Scan(&n[i])
		fmt.Scan(&k[i])

		for j :=0; j< n[i]; j++ {
			fmt.Scan(&x)
			arr[i] = append(arr[i], x)
		}
	}

	for i:=0; i< t ; i++ {
		k, v := getBeautiful(n[i], k[i], arr[i])
		if k == - 1 {
			fmt.Println(-1)
		} else {
			fmt.Println(k)
			print(v)
		}
	}
}

func print(arr []int) {
	l := len(arr)
	for i:=0; i< l; i++ {
		if i == l -1 {
			fmt.Println(arr[i])
		} else {
			fmt.Printf("%d ",arr[i])
		}
	}
}

func getBeautiful(n, k int, arr []int) (int, []int) {
	if n == k {
		result := append(arr, arr[:n-1]...)
		return (2*n -1), result
	}

	var top []int = make([]int, k)
	copy(top, arr[:k])

	i := 0
	j := k

	diff := 0

	for j < len(arr) {
		if top[i] == arr[j] {
			top = append(top, arr[j])
			if diff > 0 {
				diff--
			}
			j++
		} else {
			top = append(top, top[i])
			diff++
		}

		if diff == k {
			return -1, []int{}
		}
		i++
	}

	return len(top), top
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanln(&t)

	var n []int = make([]int, t)
	var k []int = make([]int, t)
	var arr [][]int = make([][]int, t)
	var x int

	for i:=0; i< t ; i++ {
		fmt.Scan(&n[i])
		fmt.Scan(&k[i])

		for j :=0; j< n[i]; j++ {
			fmt.Scan(&x)
			arr[i] = append(arr[i], x)
		}
	}

	for i:=0; i< t ; i++ {
		k, v := getBeautiful(n[i], k[i], arr[i])
		if k == - 1 {
			fmt.Println(-1)
		} else {
			fmt.Println(k)
			fmt.Println(v)
		}
	}
}

func getBeautiful(n, k int, arr []int) (int, []int) {
	if n == k {
		result := append(arr, arr[:n-1]...)
		return (2*n -1), result
	}

	var top []int = make([]int, k)
	copy(top, arr[:k])

	i := 0
	j := k

	diff := 0

	for j < len(arr) {
		if top[i] == arr[j] {
			top = append(top, arr[j])
			if diff > 0 {
				diff--
			}
			j++
		} else {
			top = append(top, top[i])
			diff++
		}

		if diff == k {
			return -1, []int{}
		}
		i++
	}

	return len(top), top
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanln(&t)

	var n []int = make([]int, t)
	var k []int = make([]int, t)
	var arr [][]int = make([][]int, t)
	var x int

	for i:=0; i< t ; i++ {
		fmt.Scan(&n[i])
		fmt.Scan(&k[i])

		for j :=0; j< n[i]; j++ {
			fmt.Scan(&x)
			arr[i] = append(arr[i], x)
		}
	}

	for i:=0; i< t ; i++ {
		k, v := getBeautiful(n[i], k[i], arr[i])
		if k == - 1 {
			fmt.Println(-1)
		} else {
			fmt.Println(k)
			print(v)
		}
	}
}

func print(arr []int) {
	l := len(arr)
	for i:=0; i< l; i++ {
		if i == l -1 {
			fmt.Println(arr[i])
		} else {
			fmt.Printf("%d ",arr[i])
		}
	}
}

func getBeautiful(n, k int, arr []int) (int, []int) {
	if n == k {
		result := append(arr, arr[:n-1]...)
		return (2*n -1), result
	}

	i := 0

	m := make(map[int]int)
	for i =0; i< len(arr); i++ {
		m[arr[i]] = m[arr[i]] +1
	}

	if len(m) > k {
		return -1, []int{}
	}

	for i=1; i <=n; i++ {
		m[i] = 1
		if len(m) == k {
			break
		}
	}

	var tmp, result []int

	for k, v := range m {
		for j:=0; j< v; j++ {
			tmp = append(tmp, k)
		}
	}

	for i = 0; i< n; i++ {
		result = append(result, tmp...)
	}

	return len(result), result
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanln(&t)

	var n []int = make([]int, t)
	var k []int = make([]int, t)
	var arr [][]int = make([][]int, t)
	var x int

	for i:=0; i< t ; i++ {
		fmt.Scan(&n[i])
		fmt.Scan(&k[i])

		for j :=0; j< n[i]; j++ {
			fmt.Scan(&x)
			arr[i] = append(arr[i], x)
		}
	}

	for i:=0; i< t ; i++ {
		k, v := getBeautiful(n[i], k[i], arr[i])
		if k == - 1 {
			fmt.Println(-1)
		} else {
			fmt.Println(k)
			print(v)
		}
	}
}

func print(arr []int) {
	l := len(arr)
	for i:=0; i< l; i++ {
		if i == l -1 {
			fmt.Println(arr[i])
		} else {
			fmt.Printf("%d ",arr[i])
		}
	}
}

func getBeautiful(n, k int, arr []int) (int, []int) {
	if n == k {
		result := append(arr, arr[:n-1]...)
		return (2*n -1), result
	}

	i := 0

	m := make(map[int]bool)
	for i =0; i< len(arr); i++ {
		m[arr[i]] = true
	}

	if len(m) > k {
		return -1, []int{}
	}

	for i=1; i <=n; i++ {
		m[i] = true
		if len(m) == k {
			break
		}
	}

	var tmp, result []int

	for k, _ := range m {
		tmp = append(tmp, k)
	}

	for i = 0; i< n; i++ {
		result = append(result, tmp...)
	}

	return len(result), result
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanln(&t)

	var n []int = make([]int, t)
	var k []int = make([]int, t)
	var arr [][]int = make([][]int, t)
	var x int

	for i:=0; i< t ; i++ {
		fmt.Scan(&n[i])
		fmt.Scan(&k[i])

		for j :=0; j< n[i]; j++ {
			fmt.Scan(&x)
			arr[i] = append(arr[i], x)
		}
	}

	for i:=0; i< t ; i++ {
		k, v := getBeautiful(n[i], k[i], arr[i])
		if k == - 1 {
			fmt.Println(-1)
		} else {
			fmt.Println(k)
			print(v)
		}
	}
}

func print(arr []int) {
	l := len(arr)
	for i:=0; i< l; i++ {
		if i == l -1 {
			fmt.Print("%d",arr[i])
		} else {
			fmt.Print("%d ",arr[i])
		}

	}
}

func getBeautiful(n, k int, arr []int) (int, []int) {
	if n == k {
		result := append(arr, arr[:n-1]...)
		return (2*n -1), result
	}

	var top []int = make([]int, k)
	copy(top, arr[:k])

	i := 0
	j := k

	diff := 0

	for j < len(arr) {
		if top[i] == arr[j] {
			top = append(top, arr[j])
			if diff > 0 {
				diff--
			}
			j++
		} else {
			top = append(top, top[i])
			diff++
		}

		if diff == k {
			return -1, []int{}
		}
		i++
	}

	return len(top), top
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

var pre = make([]int64,31)

func doPre(){
	pre[0] = 1
	for i :=1 ;i< 31;i++{
		pre[i] = pre[i-1] * 2
	}
}
func solve(n int) {
	var max,min int64 = 0,0
	max += pre[n]
	for i := 1;i < n;i++{
		if i <= n/2 -1 {
			max += pre[i]
		}else{
			min += pre[i]
		}
	}
	fmt.Println(math.Abs(float64(max) - float64(min)))
}

func main() {
	var t int
	scanf("%d\n",&t)
	for i:=0;i<t;i++{
		var n,k int
		scanf("%d %d\n",&n,&k)
		beautyArray := make([]int,n)
		countMap := make(map[int]int)
		maxCount := 0
		toutal := 0
		for j:=0;j<n;j++{
			if j == n-1 {
				scanf("%d\n",&beautyArray[j])
			}else {
				scanf("%d ", &beautyArray[j])
			}
			countMap[beautyArray[j]]++
			if countMap[beautyArray[j]] >  maxCount{
				maxCount = countMap[beautyArray[j]]
			}
		}
		if len(countMap) > k{
			fmt.Println("-1")
		}else{
			for _,v := range countMap{
				toutal += v
			}
			fmt.Println(toutal * k)
			result := make([]int,k)
			for i := 0;i<k;i++{
				result[i] = beautyArray[i%n]
			}
			for i:=0;i<toutal;i++{
				for j:=0;j<k;j++{
					if i == 0 && j == 0 {
						fmt.Print(result[j])
					}else {
						fmt.Print(" ", result[j])
					}
				}
				if i == toutal-1 {
					fmt.Println()
				}
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

var pre = make([]int64,31)

func doPre(){
	pre[0] = 1
	for i :=1 ;i< 31;i++{
		pre[i] = pre[i-1] * 2
	}
}
func solve(n int) {
	var max,min int64 = 0,0
	max += pre[n]
	for i := 1;i < n;i++{
		if i <= n/2 -1 {
			max += pre[i]
		}else{
			min += pre[i]
		}
	}
	fmt.Println(math.Abs(float64(max) - float64(min)))
}

func main() {
	var t int
	scanf("%d\n",&t)
	for i:=0;i<t;i++{
		var n,k int
		scanf("%d %d\n",&n,&k)
		beautyArray := make([]int,n)
		countMap := make(map[int]int)
		toutal := 0
		for j:=0;j<n;j++{
			if j == n-1 {
				scanf("%d\n",&beautyArray[j])
			}else {
				scanf("%d ", &beautyArray[j])
			}
			countMap[beautyArray[j]]++
		}
		if len(countMap) > k{
			fmt.Println("-1")
		}else{
			result := make([]int,n)
			var index int = 0
			for k,v := range countMap{
				toutal += v
				result[index] = k
				index++
			}
			for i:=len(result);i<k;i++{
				result[i] = result[0]
			}
			fmt.Println(toutal * k)
			for i:=0;i<toutal;i++{
				for j:=0;j<k;j++{
					if i == 0 && j == 0 {
						fmt.Print(result[j])
					}else {
						fmt.Print(" ", result[j])
					}
				}
				if i == toutal-1 {
					fmt.Println()
				}
			}
		}
	}
}

package main

import (
	"fmt"
	"math"
)

var pre = make([]int64,31)

func doPre(){
	pre[0] = 1
	for i :=1 ;i< 31;i++{
		pre[i] = pre[i-1] * 2
	}
}
func solve(n int) {
	var max,min int64 = 0,0
	max += pre[n]
	for i := 1;i < n;i++{
		if i <= n/2 -1 {
			max += pre[i]
		}else{
			min += pre[i]
		}
	}
	fmt.Println(math.Abs(float64(max) - float64(min)))
}

func main() {
	var t int
	fmt.Scanf("%d\n",&t)
	for i:=0;i<t;i++{
		var n,k int
		fmt.Scanf("%d %d\n",&n,&k)
		beautyArray := make([]int,n)
		countMap := make(map[int]int)
		maxCount := 0
		toutal := 0
		for j:=0;j<n;j++{
			fmt.Scanf("%d",&beautyArray[j])
			countMap[beautyArray[j]]++
			if countMap[beautyArray[j]] >  maxCount{
				maxCount = countMap[beautyArray[j]]
			}
		}
		if len(countMap) > k{
			fmt.Println("-1")
		}else{
			for _,v := range countMap{
				toutal += v
			}
			fmt.Println(toutal * k)
			result := make([]int,k)
			for i := 0;i<k;i++{
				result[i] = beautyArray[i%n]
			}
			for i:=0;i<toutal;i++{
				for j:=0;j<k;j++{
					if i == 0 && j == 0 {
						fmt.Print(result[j])
					}else {
						fmt.Print(" ", result[j])
					}
				}
				if i == toutal-1 {
					fmt.Println()
				}
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

var pre = make([]int64,31)

func doPre(){
	pre[0] = 1
	for i :=1 ;i< 31;i++{
		pre[i] = pre[i-1] * 2
	}
}
func solve(n int) {
	var max,min int64 = 0,0
	max += pre[n]
	for i := 1;i < n;i++{
		if i <= n/2 -1 {
			max += pre[i]
		}else{
			min += pre[i]
		}
	}
	fmt.Println(math.Abs(float64(max) - float64(min)))
}

func main() {
	var t int
	scanf("%d\n",&t)
	for i:=0;i<t;i++{
		var n,k int
		scanf("%d %d\n",&n,&k)
		beautyArray := make([]int,n)
		countMap := make(map[int]int)
		maxCount := 0
		toutal := 0
		for j:=0;j<n;j++{
			scanf("%d ",&beautyArray[j])
			countMap[beautyArray[j]]++
			if countMap[beautyArray[j]] >  maxCount{
				maxCount = countMap[beautyArray[j]]
			}
		}
		if len(countMap) > k{
			fmt.Println("-1")
		}else{
			for _,v := range countMap{
				toutal += v
			}
			fmt.Println(toutal * k)
			result := make([]int,k)
			for i := 0;i<k;i++{
				result[i] = beautyArray[i%n]
			}
			for i:=0;i<toutal;i++{
				for j:=0;j<k;j++{
					if i == 0 && j == 0 {
						fmt.Print(result[j])
					}else {
						fmt.Print(" ", result[j])
					}
				}
				if i == toutal-1 {
					fmt.Println()
				}
			}
		}
	}
}

package main

import (
	"fmt"
	"math"
)

var pre = make([]int64,31)

func doPre(){
	pre[0] = 1
	for i :=1 ;i< 31;i++{
		pre[i] = pre[i-1] * 2
	}
}
func solve(n int) {
	var max,min int64 = 0,0
	max += pre[n]
	for i := 1;i < n;i++{
		if i <= n/2 -1 {
			max += pre[i]
		}else{
			min += pre[i]
		}
	}
	fmt.Println(math.Abs(float64(max) - float64(min)))
}

func main() {
	var t int
	fmt.Scanf("%d\n",&t)
	for i:=0;i<t;i++{
		var n,k int
		fmt.Scanf("%d %d\n",&n,&k)
		beautyArray := make([]int,n)
		countMap := make(map[int]int)
		maxCount := 0
		toutal := 0
		for j:=0;j<n;j++{
			fmt.Scanf("%d\n",&beautyArray[j])
			countMap[beautyArray[j]]++
			if countMap[beautyArray[j]] >  maxCount{
				maxCount = countMap[beautyArray[j]]
			}
		}
		if len(countMap) > k{
			fmt.Println("-1")
		}else{
			for _,v := range countMap{
				toutal += v
			}
			fmt.Println(toutal * k)
			result := make([]int,k)
			for i := 0;i<k;i++{
				result[i] = beautyArray[i%n]
			}
			for i:=0;i<toutal;i++{
				for j:=0;j<k;j++{
					if i == 0 && j == 0 {
						fmt.Print(result[j])
					}else {
						fmt.Print(" ", result[j])
					}
				}
				if i == toutal-1 {
					fmt.Println()
				}
			}
		}
	}
}

package main

import (
	"fmt"
	"bufio"
	"os"
)

func main() {
    in := bufio.NewReader(os.Stdin)
    out := bufio.NewWriter(os.Stdout)
    defer out.Flush()
	noEx := 0
	fmt.Fscan(in, &noEx)
	for ; noEx > 0; noEx-- {
		n, k := 0, 0
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &k)
		nums := make([]int, n)
		max := 0
		for i:=0; i<n; i++ {fmt.Fscan(in, &nums[i]); if max < nums[i] {max = nums[i]}}
		max += k
		var b []int
		for _, v := range nums {
			b = append(b, v)
			rem := 0
			for t:=0; t<k-2; t++ {
				b = append(b, 1)
				rem++
			}
			b = append(b, max-v-rem)
		}
		fmt.Fprint(out, len(b))
		fmt.Fprint(out, "\n")
		for k, v := range b {
			fmt.Fprint(out, v)
			if k != len(b)-1 {fmt.Fprint(out, " ")}
		}
		fmt.Fprint(out, "\n")
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n, k := reader.NextInt64(), reader.NextInt64()
		aa := make([]int64, n)
		for i := int64(0); i < n; i++ {
			aa[i] = reader.NextInt64()
		}
		res := sol(aa, k)
		if res == nil {
			writer.Printf("-1\n")
		} else {
			writer.Printf("%d\n", len(res))
			for _, num := range res {
				writer.Printf("%d ", num)
			}
			writer.Printf("\n")
		}
	}
}

func sol(aa []int64, k int64) []int64 {
	u := map[int64]bool{}
	rep := []int64{}
	for i := int64(0); i < k; i++ {
		u[aa[i]] = true
		rep = append(rep, aa[i])
	}
	for i := k; i < int64(len(aa)); i++ {
		if !u[aa[i]] {
			return nil
		}
	}
	ret := []int64{}
	for i := 0; i < len(aa); i++ {
		ret = append(ret, rep...)
	}
	return ret
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n, k := reader.NextInt64(), reader.NextInt64()
		aa := make([]int64, n)
		for i := int64(0); i < n; i++ {
			aa[i] = reader.NextInt64()
		}
		res := sol(aa, k)
		if res == nil {
			writer.Printf("-1\n")
		} else {
			writer.Printf("%d\n", len(res))
			for _, num := range res {
				writer.Printf("%d ", num)
			}
			writer.Printf("\n")
		}
	}
}

func sol(aa []int64, k int64) []int64 {
	u := map[int64]bool{}
	rep := []int64{}
	for i := int64(0); i < k; i++ {
		u[aa[i]] = true
		rep = append(rep, aa[i])
	}
	for i := k; i < int64(len(aa)); i++ {
		if !u[aa[i]] {
			return nil
		}
	}
	ret := []int64{}
	for i := int64(0); i < int64(len(aa)) - k + 1; i++ {
		ret = append(ret, rep...)
	}
	return ret
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n, k := reader.NextInt64(), reader.NextInt64()
		aa := make([]int64, n)
		for i := int64(0); i < n; i++ {
			aa[i] = reader.NextInt64()
		}
		res := sol(aa, k)
		if res == nil {
			writer.Printf("-1\n")
		} else {
			writer.Printf("%d\n", len(res))
			for _, num := range res {
				writer.Printf("%d ", num)
			}
			writer.Printf("\n")
		}
	}
}

func sol(aa []int64, k int64) []int64 {
	u := map[int64]bool{}
	for i := int64(0); i < int64(len(aa)); i++ {
		u[aa[i]] = true
	}
	if int64(len(u)) > k {
		return nil
	}
	rep := []int64{}
	for i := range u {
		rep = append(rep, i)
	}
	for i := int64(len(rep)); i < k; i++ {
		rep = append(rep, 100) // random number
	}
	ret := []int64{}
	for i := 0; i < len(aa); i++ {
		ret = append(ret, rep...)
	}
	return ret
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n, k := reader.NextInt64(), reader.NextInt64()
		aa := make([]int64, n)
		for i := int64(0); i < n; i++ {
			aa[i] = reader.NextInt64()
		}
		res := sol(aa, k)
		if res == nil {
			writer.Printf("-1\n")
		} else {
			writer.Printf("%d\n", len(res))
			for _, num := range res {
				writer.Printf("%d ", num)
			}
			writer.Printf("\n")
		}
	}
}

func sol(aa []int64, k int64) []int64 {
	ret := []int64{}
	l := int64(0)
	r := k
	for i := l; i < r; i++ {
		ret = append(ret, aa[i])
	}
	counter := int64(0)
	for r < int64(len(aa)) {
		if aa[r] == aa[l] {
			ret = append(ret, aa[r])
			l++
			l%=k
			r++
			counter = 0
			continue
		}
		ret = append(ret, aa[l])
		l++
		l%=k
		counter++
		if counter > k {
			return nil
		}
	}
	return ret
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n, k := reader.NextInt64(), reader.NextInt64()
		aa := make([]int64, n)
		for i := int64(0); i < n; i++ {
			aa[i] = reader.NextInt64()
		}
		res := sol(aa, k)
		if res == nil {
			writer.Printf("-1\n")
		} else {
			writer.Printf("%d\n", len(res))
			for _, num := range res {
				writer.Printf("%d ", num)
			}
			writer.Printf("\n")
		}
	}
}

func sol(aa []int64, k int64) []int64 {
	u := map[int64]bool{}
	for i := int64(0); i < int64(len(aa)); i++ {
		u[aa[i]] = true
	}
	rep := []int64{}
	for i := range u {
		rep = append(rep, i)
	}
	ret := []int64{}
	for i := 0; i < len(aa); i++ {
		ret = append(ret, rep...)
	}
	return ret
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n, k := reader.NextInt64(), reader.NextInt64()
		aa := make([]int64, n)
		for i := int64(0); i < n; i++ {
			aa[i] = reader.NextInt64()
		}
		res := sol(aa, k)
		if res == nil {
			writer.Printf("-1\n")
		} else {
			writer.Printf("%d\n", len(res))
			for _, num := range res {
				writer.Printf("%d ", num)
			}
			writer.Printf("\n")
		}
	}
}

func sol(aa []int64, k int64) []int64 {
	u := map[int64]bool{}
	for i := int64(0); i < int64(len(aa)); i++ {
		u[aa[i]] = true
	}
	if int64(len(u)) > k {
		return nil
	}
	rep := []int64{}
	for i := range u {
		rep = append(rep, i)
	}
	ret := []int64{}
	for i := 0; i < len(aa); i++ {
		ret = append(ret, rep...)
	}
	return ret
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n, k := reader.NextInt64(), reader.NextInt64()
		aa := make([]int64, n)
		for i := int64(0); i < n; i++ {
			aa[i] = reader.NextInt64()
		}
		res := sol(aa, k)
		if res == nil {
			writer.Printf("-1\n")
		} else {
			writer.Printf("%d\n", len(res))
			for _, num := range res {
				writer.Printf("%d ", num)
			}
			writer.Printf("\n")
		}
	}
}

func sol(aa []int64, k int64) []int64 {
	u := map[int64]bool{}
	rep := []int64{}
	for i := int64(0); i < k; i++ {
		u[aa[i]] = true
		rep = append(rep, aa[i])
	}
	for i := k; i < int64(len(aa)); i++ {
		if !u[aa[i]] {
			return nil
		}
	}
	ret := []int64{}
	for i := int64(0); i < k; i++ {
		ret = append(ret, rep...)
	}
	return ret
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		n, k := reader.NextInt64(), reader.NextInt64()
		aa := make([]int64, n)
		for i := int64(0); i < n; i++ {
			aa[i] = reader.NextInt64()
		}
		res := sol(aa, k)
		if res == nil {
			writer.Printf("-1\n")
		} else {
			writer.Printf("%d\n", len(res))
			for _, num := range res {
				writer.Printf("%d ", num)
			}
			writer.Printf("\n")
		}
	}
}

func sol(aa []int64, k int64) []int64 {
	u := map[int64]bool{}
	rep := []int64{}
	for i := int64(0); i < k; i++ {
		u[aa[i]] = true
		rep = append(rep, aa[i])
	}
	for i := k; i < int64(len(aa)); i++ {
		if !u[aa[i]] {
			return nil
		}
	}
	ret := []int64{}
	for i := 0; i < 100; i++ {
		ret = append(ret, rep...)
	}
	return ret
}