1
2 1
-2 -3
 3
1 1
1
5 4
5 -1 4 2 0
1 2
69
 1
5 1
-5 -4 -3 -2 -1
 1
2 1
-6 -9
 1
1 398708496844866113
959414461
 1
2 1
-5 -4
 2
3 1
-1 -2 0
3 2
-1 -2 0
 1
5 1
-1 -2 -3 -4 -5
 1
2 1
-1000000000 -1000000000
 1
2 1
-199 -191
 1
1 1
-1000
 1
2 1
-5 -5
 1
5 5
-999999995 -999999996 -999999997 -999999998 -999999999
 1
3 1
-4 -5 -6
 1
1 1
-1
 1
3 1
-3 -4 -5
 1
3 1
-1000000000 -1000000000 -1000000000
 1
2 1
-10 -11
 1
3 3
-100 -100 -100
 1
3 1
-1 -2 -3
 1
5 5
-10 -9 -8 -7 -6
 1
4 1
-1 -1 -1 -1
 1
2 1
-1 -2
 1
3 999
1000000000 -1000000000 -31
 5
20 809014
289 -254 1 -109 -167 93 23 -37 -31 -109 204 59 296 49 132 0 -28 35 -197 -266
20 458494
113 218 -292 -298 179 258 -257 -20 296 76 -145 93 -282 -261 -159 -45 255 -107 171 63
14 876161
69 74 12 2 177 -113 103 93 38 -48 282 169 205 145
26 731742
76 190 -227 -81 -293 243 -122 -122 252 16 -88 243 -216 -275 -267 188 144 -245 -117 -244 -259 281 -273 -206 112 -51
20 327039
42 133 231 128 19 181 -137 193 136 75 -203 55 37 -155 -219 182 -178 -280 2 132
 4
6 4
219 57 -58 230 173 177
2 4
266 176
3 2
134 -190 202
5 69
-1000000000 -1000000000 1000000000 0 1000000000
 1
5 1
-9 -8 -7 -6 -5
 1
3 1
-1 -4 -10
 1
5 3
-4 -5 -6 -7 -8
 1
2 3
-3 -3
 1
5 1000000000000000000
-5 -4 -3 -2 -1

0 1  
 0  
6 0 5 3 1  
0  
 4 3 2 1 0  
 0 3  
 0  
 1 0  
 1 2 0  
1 0 2  
 0 1 2 3 4  
 0 0  
 8 0  
 0  
 0 0  
 0 1 2 3 4  
 0 1 2  
 0  
 0 1 2  
 0 0 0  
 0 1  
 0 0 0  
 0 1 2  
 4 3 2 1 0  
 0 0 0 0  
 0 1  
 0 2000000000 1000000031  
 555 12 267 157 99 359 289 229 235 157 470 325 562 315 398 266 238 301 69 0  
411 516 6 0 477 556 41 278 594 374 153 391 16 37 139 253 553 191 469 361  
213 208 270 280 105 395 179 189 244 330 0 113 77 137  
369 483 66 212 0 536 171 171 545 309 205 536 77 18 26 481 437 48 176 49 34 574 20 87 405 242  
189 98 0 103 212 50 368 38 95 156 434 176 194 386 450 49 409 511 229 99  
 277 115 0 288 231 235  
90 0  
324 0 392  
2000000000 2000000000 0 1000000000 0  
 4 3 2 1 0  
 0 3 9  
 0 1 2 3 4  
 0 0  
 0 1 2 3 4  

/*

    /$$$$$  /$$$$$$  /$$    /$$  /$$$$$$                                                                  
   |__  $$ /$$__  $$| $$   | $$ /$$__  $$                                                                 
	  | $$| $$  \ $$| $$   | $$| $$  \ $$                                                                 
	  | $$| $$$$$$$$|  $$ / $$/| $$$$$$$$                                                                 
 /$$  | $$| $$__  $$ \  $$ $$/ | $$__  $$                                                                 
| $$  | $$| $$  | $$  \  $$$/  | $$  | $$                                                                 
|  $$$$$$/| $$  | $$   \  $/   | $$  | $$                                                                 
 \______/ |__/  |__/    \_/    |__/  |__/                                                                 
 /$$$$$$$  /$$$$$$$   /$$$$$$   /$$$$$$  /$$$$$$$   /$$$$$$  /$$      /$$ /$$      /$$ /$$$$$$$$ /$$$$$$$ 
| $$__  $$| $$__  $$ /$$__  $$ /$$__  $$| $$__  $$ /$$__  $$| $$$    /$$$| $$$    /$$$| $$_____/| $$__  $$
| $$  \ $$| $$  \ $$| $$  \ $$| $$  \__/| $$  \ $$| $$  \ $$| $$$$  /$$$$| $$$$  /$$$$| $$      | $$  \ $$
| $$$$$$$/| $$$$$$$/| $$  | $$| $$ /$$$$| $$$$$$$/| $$$$$$$$| $$ $$/$$ $$| $$ $$/$$ $$| $$$$$   | $$$$$$$/
| $$____/ | $$__  $$| $$  | $$| $$|_  $$| $$__  $$| $$__  $$| $$  $$$| $$| $$  $$$| $$| $$__/   | $$__  $$
| $$      | $$  \ $$| $$  | $$| $$  \ $$| $$  \ $$| $$  | $$| $$\  $ | $$| $$\  $ | $$| $$      | $$  \ $$
| $$      | $$  | $$|  $$$$$$/|  $$$$$$/| $$  | $$| $$  | $$| $$ \/  | $$| $$ \/  | $$| $$$$$$$$| $$  | $$
|__/      |__/  |__/ \______/  \______/ |__/  |__/|__/  |__/|__/     |__/|__/     |__/|________/|__/  |__/
																																																					
																																																					

*/

import java.util.*;
import java.io.*;
import java.math.*;
import java.io.FileWriter; 
import java.io.IOException; 
public class cf{
	static class Pair{
		int x;
		int y;
		public Pair(int x,int y){
			this.x=x;
			this.y=y;
		}
	}
    static InputReader sc;
    static PrintWriter pw;
////////////////////////////////////Code Start/////////////////////////////////////////////////    
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        sc = new InputReader(inputStream);
        pw = new PrintWriter(outputStream);
        solve();
        pw.close();
    }
   
    public static void solve() {
       int t=s(0);
       while(t-->0){
       	int n=s(0);
       	long k=s(0l);
       	long a[]=new long[n];
       	feedArr(a);
       	long max=Long.MIN_VALUE;
       	for(int i=0;i<n;i++){
       	   max=Math.max(max,a[i]);    
       	} 
        long next=Long.MIN_VALUE;;
       	if(k>=1){
       		for(int i=0;i<n;i++){
       		  a[i]=max-a[i];   
       		  next=Math.max(a[i],next);
       		}
       		k--;
       	}

       	if(k>=1 && k%2!=0){
       		for(int i=0;i<n;i++){
       		   a[i]=next-a[i];   
       		}
       	}

       	pln(printArr(a));
       
    }
}
  
////////////////////////////////////Code End//////////////////////////////////////////////////
	 static int LowerBound(ArrayList<Integer> a, int x) { 
		  int l=-1,r=a.size();
		  while(l+1<r) {
		    int m=(l+r)>>>1;
		    if(a.get(m)>=x) r=m;
		    else l=m;
		  }
		  return r;
	   }
    static int UpperBound(int a[], int x) {
	    int l=-1,r=a.length;
	    while(l+1<r) {
	       int m=(l+r)>>>1;
	       if(a[m]<=x) l=m;
	       else r=m;
	    }
	    return l+1;
	  }

    public static long atMostK(char []chrr, int k){
        if(k<0)
            return 0;
        int l=0,cnt=0;
        long ans=0l;
        for(int i=0;i<chrr.length;i++){
            if(chrr[i]=='1')
                cnt++;
            while(cnt>k){
                if(chrr[l++]=='1')
                    cnt--;
            }
            ans+=(long)(i-l)+1l;
        }
        return ans;
    }
    public static int ask(int l, int r){
        System.out.println("? "+l+" "+r);
        System.out.flush();
        return sc.nextInt();
    }
    public static void sort(long []arr){
        ArrayList<Long> list=new ArrayList<>();
        for(int i=0;i<arr.length;i++)
            list.add(arr[i]);
        Collections.sort(list);
        for(int i=0;i<arr.length;i++)
            arr[i]=list.get(i);
    }
    public static void swap(char []chrr, int i, int j){
        char temp=chrr[i];
        chrr[i]=chrr[j];
        chrr[j]=temp;
    }
    public static int countSetBits(int n){
        int a=0;
        while(n>0){
            a+=(n&1);
            n>>=1;
        }
        return a;
    }
   

    static boolean isPrime(int n) { 
        if (n <= 1) 
            return false; 
        if (n <= 3) 
            return true; 
        if (n % 2 == 0 || n % 3 == 0) 
            return false; 
        for (int i = 5; i * i <= n; i = i + 6) 
            if (n % i == 0 || n % (i + 2) == 0) 
                return false; 
        return true; 
    } 
    static long gcd(long a, long b) { 
        if (b == 0) 
            return a; 
        return a>b?gcd(b, a % b):gcd(a, b % a);  
    } 
    static long fast_pow(long base,long n,long M){
        if(n==0)
           return 1;
        if(n==1)
        return base;
        long halfn=fast_pow(base,n/2,M);
        if(n%2==0)
            return ( halfn * halfn ) % M;
        else
            return ( ( ( halfn * halfn ) % M ) * base ) % M;
    }
    static long modInverse(long n,long M){
        return fast_pow(n,M-2,M);
    }
    public static int s(int n){
        return sc.nextInt();
    }
    public static long s(long n){
        return sc.nextLong();
    }
    public static String s(String n){
        return sc.next();
    }
    public static double s(double n){
        return sc.nextDouble();
    }
    public static void p(int n){
        pw.print(n);
    }
    public static void p(long n){
        pw.print(n);
    }
    public static void p(String n){
        pw.print(n);
    }
    public static void p(double n){
        pw.print(n);
    }
    public static void pln(int n){
        pw.println(n);
    }
    public static void pln(long n){
        pw.println(n);
    }
    public static void pln(String n){
        pw.println(n);
    }
    public static void pln(double n){
        pw.println(n);
    }
    public static void feedArr(long []arr){
        for(int i=0;i<arr.length;i++)
            arr[i]=sc.nextLong();
    }
    public static void feedArr(double []arr){
        for(int i=0;i<arr.length;i++)
            arr[i]=sc.nextDouble();
    }
    public static void feedArr(int []arr){
        for(int i=0;i<arr.length;i++)
            arr[i]=sc.nextInt();
    }
    public static void feedArr(String []arr){
        for(int i=0;i<arr.length;i++)
            arr[i]=sc.next();
    }
    public static String printArr(int []arr){
        StringBuilder sbr=new StringBuilder();
        for(int i:arr)
            sbr.append(i+" ");
        return sbr.toString();
    }
    public  static String printArr(long []arr){
        StringBuilder sbr=new StringBuilder();
        for(long i:arr)
            sbr.append(i+" ");
        return sbr.toString();
    }
    public static String printArr(String []arr){
        StringBuilder sbr=new StringBuilder();
        for(String i:arr)
            sbr.append(i+" ");
        return sbr.toString();
    }
    public static String printArr(double []arr){
        StringBuilder sbr=new StringBuilder();
        for(double i:arr)
            sbr.append(i+" ");
        return sbr.toString();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
 
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}
