#include <bits/stdc++.h>

using namespace std;

const int MAX = 10000;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> cnt(MAX);
    for (int i = 0; i < n + m; i++) {
        int x;
        cin >> x;
        ++cnt[x];
    }
    for (int i = 0; i < MAX; i++) {
        if (cnt[i] == 1) {
            cout << i << " ";
        }
    }
    return 0;
}
#include <bits/stdc++.h>
#include<iostream>

using namespace std;
typedef long long ll;

int keta(ll n) {
    return log10(n)+1;
}

ll f() {
    for (int i = 0; i< 10;i++) {}
    for (int j = 0; j< 10;j++) {}
    ll p = 3* 2e18;
    vector<ll> vec;
    vec.push_back(0);
    vec.back();
    vec.pop_back();
    for_each(vec.begin(), vec.end(), [](ll& elem) {
        elem = 4;
    });
    return 0;
}

int main(){
	ll N,M;
	cin>>N>>M;

    vector<ll> A,B;
    for (int i = 0; i< N;i++) {
        ll a;
        cin>>a;
        A.push_back(a);
    }
    for (int i = 0; i< M;i++) {
        ll b;
        cin>>b;
        B.push_back(b);
    }
    reverse(A.begin(),A.end());
    reverse(B.begin(),B.end());
    vector<ll> C;
    while (!A.empty() || !B.empty())
    {
        if (A.empty()) {
            ll b=B.back();
            C.push_back(b);
            B.pop_back();
        } else if (B.empty()){
            ll a =A.back();
            C.push_back(a);
            A.pop_back();
        } else {
            ll a =A.back();
            ll b=B.back();
            if (a<b){
                C.push_back(a);
                A.pop_back();
            } else if (a==b){
                A.pop_back();
                B.pop_back();
            } else {
                C.push_back(b);
                B.pop_back();
            }
        }
    }

    ll cl = C.size();
    
    for (int i = 0; i< cl;i++) {
        cout<<C[i]<<" ";
    }
    cout<<endl;
	return 0;
}