#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main(){
    int N,M;
    cin >> N >> M;
    vector<int>A(N);
    vector<int>B(M);
    for(int i = 0; i < N; i++){
        cin >> A.at(i);
    }
    for(int i = 0; i < M; i++){
        cin >> B.at(i);
    }
    vector<int>cnt(1001);
    for(int i = 0; i < 1001; i++){
        cnt.at(i) = 0;
    }
    for(int i = 0; i < N; i++){
        cnt.at(A.at(i))++;
    }
    for(int i = 0; i < M; i++){
        cnt.at(B.at(i))++;
    }
    for(int i = 0; i < 1001; i++){
        if(cnt.at(i) == 1){
            cout << i << " ";
        }
    }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define rep1(i,n) for(int i = 1 ; i <= (n) ; i++)
#define rrep(i,n) for(int i = (n) - 1 ; i >= 0 ; i--)
#define rrep1(i,n) for(int i = (n) ; i > 0 ; i--)
#define INF 1001001001
#define MOD 1000000007
using ll = int64_t;
using P = pair<int, int>;
using PL = pair<ll,ll>;
using PD = pair<double,double>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define v(n) vector<n>
#define vv(n) vector<vector<n>>
#define vvv(n) vector<vector<vector<n>>>
#define line cout << "================================" << endl;
#define Yn(x) cout << ((x) ? "Yes" : "No") << endl;
#define yn(x) cout << ((x) ? "yes" : "no") << endl;
#define mmax(a,b) a = max(a,b)
#define mmin(a,b) a = min(a,b)
#define debug(x) cout << #x" : " << x << endl;

int main(){
    int n, m;
    cin >> n >> m;
    vi vec(1001,0);
    rep(i,n){
        int x;
        cin >> x;
        vec[x]++;
    }
    rep(i,m){
        int x;
        cin >> x;
        vec[x]++;
    }
    
    
   rep(i,vec.size()){
       if(vec[i] == 1)cout << i << " ";
   }
    cout << endl;
}