using System;
class Program
{
static long max = -9223372036854775733L;
static long tempMax = max;
static long[] A;
static int N, K;
static void Main(string[] args)
{
Input();
Logic();
Display();
// Console.ReadLine();
}
static void Input()
{
string[] x;
x = Console.ReadLine().Split(' ');
N = Convert.ToInt32(x[0]);
K = Convert.ToInt32(x[1]);
x = Console.ReadLine().Split(' ');
A = new long[N];
for (int n = 0; n < N; n++)
{
A[n] = Convert.ToInt64(x[n]);
if (A[n] > max)
{
max = A[n];
}
}
}
static void Logic()
{
if ((K % 2 == 0) && K != 0)
{
Calculate();
Calculate();
}
if ((K % 2 == 1) && K != 0)
{
Calculate();
}
}
static void Calculate()
{
tempMax = max;
for (int n = 0; n < N; n++)
{
A[n] = max - A[n];
if (A[n] > max)
{
tempMax = A[n];
}
}
max = tempMax;
}
static void Display()
{
for (int n = 0; n < N; n++)
{
Console.Write(A[n] + " ");
}
Console.WriteLine();
}
}
dXNpbmcgU3lzdGVtOwpjbGFzcyBQcm9ncmFtCnsKc3RhdGljIGxvbmcgbWF4ID0gLTkyMjMzNzIwMzY4NTQ3NzU3MzNMOwpzdGF0aWMgbG9uZyB0ZW1wTWF4ID0gbWF4OwpzdGF0aWMgbG9uZ1tdIEE7CnN0YXRpYyBpbnQgTiwgSzsKc3RhdGljIHZvaWQgTWFpbihzdHJpbmdbXSBhcmdzKQp7CklucHV0KCk7CkxvZ2ljKCk7CkRpc3BsYXkoKTsKLy8gQ29uc29sZS5SZWFkTGluZSgpOwp9CnN0YXRpYyB2b2lkIElucHV0KCkKewpzdHJpbmdbXSB4Owp4ID0gQ29uc29sZS5SZWFkTGluZSgpLlNwbGl0KCcgJyk7Ck4gPSBDb252ZXJ0LlRvSW50MzIoeFswXSk7CksgPSBDb252ZXJ0LlRvSW50MzIoeFsxXSk7CnggPSBDb25zb2xlLlJlYWRMaW5lKCkuU3BsaXQoJyAnKTsKQSA9IG5ldyBsb25nW05dOwpmb3IgKGludCBuID0gMDsgbiA8IE47IG4rKykKewpBW25dID0gQ29udmVydC5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