#include<stdio.h>
int main()
{
long long i, n, k, a[100000], max = 0,t;
scanf("%lld %lld", &n, &k);
if (n == 1)
{
if (k == 0)
{
scanf("%lld", &t);
printf("%lld", t);
}
else
{
printf("0");
}
}
else
if (k == 0)
{
for (i = 0; i < n; i++)
printf("ll%d ", a[i]);
}
else
{
for (i = 0; i < n; i++)
{
scanf("%lld", &a[i]);
if (max < a[i])
{
max = a[i];
}
}
for (i = 0; i < n; i++)
a[i] = max - a[i];
max = 0;
for (i = 0; i < n; i++)
if (max < a[i])
{
max = a[i];
}
if (k % 2 == 0)
{
for (i = 0; i < n; i++)
{
a[i] = max - a[i];
printf("%lld", a[i]);
}
}
else
for (i = 0; i < n; i++)
printf("%lld", a[i]);
}
return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KaW50IG1haW4oKQp7Cglsb25nIGxvbmcgaSwgbiwgaywgYVsxMDAwMDBdLCBtYXggPSAwLHQ7CgoJc2NhbmYoIiVsbGQgJWxsZCIsICZuLCAmayk7CgoJaWYgKG4gPT0gMSkKCXsKCQlpZiAoayA9PSAwKQoJCXsKCQkJc2NhbmYoIiVsbGQiLCAmdCk7CgkJCXByaW50ZigiJWxsZCIsIHQpOwoJCQoJCX0KCQllbHNlCgkJewoJCQlwcmludGYoIjAiKTsKCQkJCgkJfQoJfQoJZWxzZSAKCWlmIChrID09IDApCgl7CgkJZm9yIChpID0gMDsgaSA8IG47IGkrKykKCQkJcHJpbnRmKCJsbCVkICIsIGFbaV0pOwoJfQoJZWxzZQoKCXsKCQlmb3IgKGkgPSAwOyBpIDwgbjsgaSsrKQoJCXsKCQkJc2NhbmYoIiVsbGQiLCAmYVtpXSk7CgkJCWlmIChtYXggPCBhW2ldKQoJCQl7CgkJCQltYXggPSBhW2ldOwoJCQl9CgkJfQoKCgkJZm9yIChpID0gMDsgaSA8IG47IGkrKykKCQkJYVtpXSA9IG1heCAtIGFbaV07CgkJbWF4ID0gMDsKCQlmb3IgKGkgPSAwOyBpIDwgbjsgaSsrKQ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