#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    long long a[n], b[n], c[n];
    priority_queue<long long> q;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      q.push(a[i]);
    }
    for (long long i = 0; i < n; i++) {
      b[i] = q.top() - a[i];
    }
    for (long long i = 0; i < n; i++) {
      q.pop();
    }
    for (long long i = 0; i < n; i++) {
      q.push(b[i]);
    }
    for (long long i = 0; i < n; i++) {
      c[i] = q.top() - b[i];
    }
    if (k % 2 == 0) {
      for (long long i = 0; i < n; i++) cout << c[i] << " ";
    } else {
      for (long long i = 0; i < n; i++) cout << b[i] << " ";
    }
    cout << endl;
  }
}
