#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < int(n); i++)
using ll = long long;
using P = pair<int, int>;

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    vector<int> ans;
    rep(i, n) {
        bool ok = true;
        rep(j, m) {
            if(a[i] == b[j]) ok = false;
        }
        if(ok) ans.push_back(a[i]);
    }
    rep(i, m) {
        bool ok = true;
        rep(j, n) {
            if(b[i] == a[j]) ok = false;
        }
        if(ok) ans.push_back(b[i]);
    }
    sort(ans.begin(), ans.end());
    rep(i, ans.size()) {
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> A(N), B(M);
    for (auto &Ai : A)
        cin >> Ai;
    for (auto &Bi : B)
        cin >> Bi;
    set<int> XOR;
    for (auto Ai : A)
        XOR.insert(Ai);
    for (auto Bi : B) {
        if (XOR.count(Bi))
            XOR.erase(Bi);
        else
            XOR.insert(Bi);
    }
    bool is_head = true;
    for (auto XORi : XOR) {
        if (!is_head)
            cout << ' ';
        cout << XORi;
        is_head = false;
    }
    cout << endl;
}
