#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define setbits(n) __builtin_popcountll(n)
#define mkunique(a) a.resize(unique(a.begin(),a.end())-a.begin());
void prints(set<ll> s) {for(ll u: s) cout<<u<<" "; cout<<"\n";}
void printms(multiset<ll> s) {for(ll u: s) cout<<u<<" "; cout<<"\n";}
void printv(vector<ll> s) {for(ll u: s) cout<<u<<" "; cout<<"\n";}
const ll mod=1e9+7;


int main(){
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll T=clock();

    ll n,m;
    cin>>n>>m;
    vector<ll> a(n), b(m);
    for(ll i=0;i<n;i++)
        cin>>a[i];
    for(ll i=0;i<m;i++)
        cin>>b[i];
    vector<ll> ans;
    for(ll i=0;i<n;i++){
        ll val=a[i];
        bool ok=true;
        for(ll u: b){
            if(u==val){
                ok=false;
                break;
            }
        }
        if(ok) ans.pb(val);
    }
    for(ll i=0;i<m;i++){
        ll val=b[i];
        bool ok=true;
        for(ll u: a){
            if(u==val){
                ok=false;
                break;
            }
        }
        if(ok) ans.pb(val);
    }
    sort(ans.begin(),ans.end());
    for(ll u: ans)
        cout<<u<<" ";

 
    cerr<<"\n\nTIME: "<<(long double)(clock()-T)/CLOCKS_PER_SEC<<" sec\n";
    T = clock();
    return 0;
}

// Author: Muhesh Kumar

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

using ll  = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vl>;
#define nl '\n'
#define fr first
#define sc second
#define pb push_back
#define bg(x) begin(x)
#define all(x) bg(x), end(x)
#define sz(x) (int) (x).size()
#define trav(a, b) for(auto &a: b)
#define rep(i, a, b) for(int i = a; i < b; i++)

int main() {
 
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m; cin >> n >> m;
    vector<int> a(n), b(m);
    unordered_map<int, int> occ1, occ2;
    trav(i, a) {
        cin >> i;
        occ1[i]++;
    }
    trav(i, b) {
        cin >> i;
        occ2[i]++;
    }

    vector<int> res;
    trav(i, a) {
        if (!occ2.count(i)) res.pb(i);
    }
    trav(i, b) {
        if (!occ1.count(i)) res.pb(i);
    }

    sort(all(res));
    trav(i, res) cout << i << " ";


    return 0;
}