#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<long long >>;

int C[2000] = {0};

int main(){
    int N,M;
    cin >> N >> M;
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        C[a]++;
    }
    for(int i=0;i<M;i++){
        int b;
        cin >> b;
        C[b]++;
    }
    for(int i=0;i<2000;i++){
        if(C[i]==1){
            cout << i <<' ';
        }
    }
    cout << endl;
}
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using v1 = vector<ll>;
using v2 = vector<vector<ll>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
 
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;
 
#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;
using P = pair<ll,ll>;
 
template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}
 
const ll INF = 1e9;
const ll mod = 1e9+7;

int main(){
    int n, m;
    cin >> n >> m;
    v1 x(n+m);
    REP(i,n+m) cin >> x[i];
    x.push_back(0);
    x.push_back(INF);
    v1 ans;
    sort(x.begin(),x.end());
    for(int i = 1; i <= n+m; i++){
        if(x[i] != x[i+1] && x[i] != x[i-1]) ans.push_back(x[i]);
    }
    if(ans.size()!=0){
        cout << ans[0];
        REP(i,ans.size()-1) cout << " " << ans[i+1];
    }
    cout << endl;
}