#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
long long n,k,mx=INT_MIN;
cin>>n>>k;
vector<long long> v(n);
for(int i=0;i<n;i++)
{
cin>>v[i];
mx=max(mx , v[i]);
}
if(k&1) //k is odd
{
for(auto x:v)
cout<<mx-x<<" ";
cout<<endl;
}
else
{
for(auto x:v) cout<<x<<" ";
cout<<endl;
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCWludCB0OwoJY2luPj50OwoJd2hpbGUodC0tKQoJewoJCWxvbmcgbG9uZyBuLGssbXg9SU5UX01JTjsKCQljaW4+Pm4+Pms7CgkJdmVjdG9yPGxvbmcgbG9uZz4gdihuKTsKCQlmb3IoaW50IGk9MDtpPG47aSsrKQoJCXsKCQkJY2luPj52W2ldOwoJCQlteD1tYXgobXggLCB2W2ldKTsKCQl9CgkJaWYoayYxKSAvL2sgaXMgb2RkCgkJewoJCQlmb3IoYXV0byB4OnYpCgkJCQljb3V0PDxteC14PDwiICI7CgkJCWNvdXQ8PGVuZGw7CgkJfQoJCWVsc2UKCQl7CgkJCWZvcihhdXRvIHg6dikgY291dDw8eDw8IiAiOwoJCQljb3V0PDxlbmRsOwoJCX0KCX0KCXJldHVybiAwOwp9Cgo=