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.*;
public class Main {
    public static boolean visited[];
    public static Integer distances[];
    public static void main ( String args[] ) {
        FastReader sc = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = sc.nextInt();

        while (t-- > 0) {
            int n = sc.nextInt();
            int k = sc.nextInt() ;
            int a[] = new int[n];
            int max = -1000000000;
            int indx = -1;
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
                if (max <= a[i]) {
                    max = a[i];
                    indx = i;
                }
            }
            for (int i = 0; i < n; i++) {
                if (i == indx)
                    a[i] = 0;
                else {
                    a[i] = max - a[i];
                }
            }
            for(int i = 0 ; i < n ;i++)
                System.out.print(a[i]+" ");
            System.out.println();
        }
        }



    static class Graph
    {
        public int V;
        public LinkedList<Integer> adj[];
        Graph(int v)
        {
            V = v;
            visited = new boolean[v+1];
            distances = new Integer[v+1];
            for(int i = 0 ; i <v+1 ; i++)
                distances[i] = -1  ;
            adj = new LinkedList[v+1];
            for (int i=0; i<v+1; ++i)
                adj[i] = new LinkedList<Integer>();
        }
        void addEdge(int v, int w)
        {
            adj[v].add(w);
        }
        void dfs(int node) {
            visited[node]= true;
            System.out.print(node+" ");
            for(int x :adj[node]) {
                if(!visited[x])
                    dfs(x);
            }

        }
        void bfs(int node){
            Queue<Integer> q = new LinkedList<Integer>();   ;
            distances[node]= 0 ;
            q.add(node);
            while(!q.isEmpty()){
                int src = q.peek();
                System.out.print(src+" ");
                q.remove();
                int cost = distances[src];
                for(int child : adj[src]){
                    if(distances[child]==-1){
                        q.add(child);
                        distances[child]= cost+1;
                    }
                }
            }
        }
        public  int graph_height(int node) {
            int h = 0 ;
            for(int x : adj[node])
                h= Math.max(h,1+graph_height(x));

            return h ;

        }
    }

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {

            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}
class Pair {
    int x ;
    int y ;
    public Pair(int x ,int y){
        this.x = x;
        this.y=y;}
}

class Pair1 implements Comparable{
    int x ;
    int y ;
    public Pair1(int x ,int y){
        this.x = x;
        this.y=y;}
    public int compareTo(Object o) {
        Pair1 a = (Pair1) o ;

        return (this.x-a.x);
    }

}
class Pair2 implements Comparable{
    int x ;
    int y ;
    public Pair2(int x ,int y){
        this.x = x;
        this.y=y;}
    public int compareTo(Object o) {
        Pair2 a = (Pair2) o ;

        return (this.y-a.y);
    }
}
class BinaryIndexedTree {

    // Max tree size
    final static int MAX = 100005;

    static long BITree[] = new long[MAX];

    // Updates a node in Binary Index
    // Tree (BITree) at given index
    // in BITree. The given value 'val'
    // is added to BITree[i] and
    // all of its ancestors in tree.
    public  void updateBIT(int n,
                                 int index,
                                 long val) {
        // index in BITree[] is 1
        // more than the index in arr[]
        index = index + 1;

        // Traverse all ancestors
        // and add 'val'
        while (index <= n) {
            // Add 'val' to current
            // node of BITree
            BITree[index] += val;

            // Update index to that
            // of parent in update View
            index += index & (-index);
        }
    }

    // Constructs Binary Indexed Tree
    // for given array of size n.

    public  void constructBITree(long arr[],
                                       int n) {
        // Initialize BITree[] as 0
        for (int i = 1; i <= n; i++)
            BITree[i] = 0;

        // Store the actual values
        // in BITree[] using update()
        for (int i = 0; i < n; i++)
           updateBIT(n, i, arr[i]);

        // Uncomment below lines to
        // see contents of BITree[]
        // for (int i=1; i<=n; i++)
        //     cout << BITree[i] << " ";
    }

    // SERVES THE PURPOSE OF getElement()
    // Returns sum of arr[0..index]. This
    // function assumes that the array is
    // preprocessed and partial sums of
    // array elements are stored in BITree[]
    public  long getSum(int index) {
        long sum = 0; //Initialize result

        // index in BITree[] is 1 more
        // than the index in arr[]
        index = index + 1;

        // Traverse ancestors
        // of BITree[index]
        while (index > 0) {

            // Add current element
            // of BITree to sum
            sum += BITree[index];

            // Move index to parent
            // node in getSum View
            index -= index & (-index);
        }

        // Return the sum
        return sum;
    }

    // Updates such that getElement()
    // gets an increased value when
    // queried from l to r.
    public  void update(int l, int r,
                              int n, long val) {
        // Increase value at
        // 'l' by 'val'
        updateBIT(n, l, val);

        // Decrease value at
        // 'r+1' by 'val'
        updateBIT(n, r + 1, -val);
    }
}