#include <iostream>
using namespace std;
int main() {
int n, m, v[100000], w[100000];
cin >> n >> m;
for (int i = 1; i <= n; ++i) {
cin >> v[i];
}
for (int j = 1; j <= n - m; ++j) {
cin >> w[j];
}
int aux[m];
int z = 0, i = 1, j = 1;
if(n==n-m){
cout << "Nu s-au pierdut date";
}
if (n > m) {
while (i <= n && z <= m) {
if (v[i] != w[j]) {
++z;
aux[z] = v[i];
++i;
} else if (v[i] == w[j]) {
++i;
++j;
} else {
++z;
aux[z] = v[i];
++i;
}
}
for (int z = 1; z <= m; ++z) {
cout << aux[z] << " ";
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CiAgICBpbnQgbiwgbSwgdlsxMDAwMDBdLCB3WzEwMDAwMF07CiAgICBjaW4gPj4gbiA+PiBtOwogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgKytpKSB7CiAgICAgICAgY2luID4+IHZbaV07CiAgICB9CiAgICBmb3IgKGludCBqID0gMTsgaiA8PSBuIC0gbTsgKytqKSB7CiAgICAgICAgY2luID4+IHdbal07CiAgICB9CiAgICBpbnQgYXV4W21dOwogICAgaW50IHogPSAwLCBpID0gMSwgaiA9IDE7CiAgICBpZihuPT1uLW0pewogICAgCWNvdXQgPDwgIk51IHMtYXUgcGllcmR1dCBkYXRlIjsKICAgIH0KICAgIGlmIChuID4gbSkgewogICAgICAgIHdoaWxlIChpIDw9IG4gJiYgeiA8PSBtKSB7CiAgICAgICAgICAgIGlmICh2W2ldICE9IHdbal0pIHsKICAgICAgICAgICAgICAgICsrejsKICAgICAgICAgICAgICAgIGF1eFt6XSA9IHZbaV07CiAgICAgICAgICAgICAgICArK2k7CiAgICAgICAgICAgIH0gZWxzZSBpZiAodltpXSA9PSB3W2pdKSB7CiAgICAgICAgICAgICAgICArK2k7CiAgICAgICAgICAgICAgICArK2o7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICArK3o7CiAgICAgICAgICAgICAgICBhdXhbel0gPSB2W2ldOwogICAgICAgICAgICAgICAgKytpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGZvciAoaW50IHogPSAxOyB6IDw9IG07ICsreikgewogICAgICAgICAgICBjb3V0IDw8IGF1eFt6XSA8PCAiICI7CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIDA7Cn0=