#include <bits/stdc++.h>
using namespace std;
int minn(int a, int b) {
  if (a < b) return a;
  return b;
}
int maxx(int a, int b) {
  if (a > b) return a;
  return b;
}
int main() {
  int tt = 1;
  cin >> tt;
  long long int n, k;
  while (cin >> n >> k) {
    long long int a[200005], i, mx = -1000000009, mx2;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      mx = maxx(mx, a[i]);
    }
    int times = 0;
    while (times < k) {
      if (times > 4 && ((times & 1) == (k & 1))) break;
      mx2 = -1000000009;
      for (i = 0; i < n; i++) {
        a[i] = mx - a[i];
        mx2 = maxx(mx2, a[i]);
      }
      mx = mx2;
      times++;
    }
    for (i = 0; i < n; i++) {
      cout << a[i] << ' ';
    }
    cout << endl;
  }
}
