#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
int M=1000000007;
const int N=200005;

signed main(){
  int t1=1;
  //cin>>t1;

  while(t1--){
    int n,m;
    cin>>n>>m;

    map<int,int> mp;
    for(int i=0;i<n+m;i++){
      int x;
      cin>>x;
      mp[x]++;
    }

    for(auto it:mp) if(it.second==1) cout<<it.first<<" ";
    cout<<endl;
  }
}

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
int main() {
    int n, m;
    cin >> n >> m;
    set<int> a, b, ab;
    rep (i, n) {
        int c;
        cin >> c;
        a.insert(c);
        ab.insert(c);
    }
    rep(i, m) {
        int d;
        cin >> d;
        b.insert(d);
        ab.insert(d);
    }
    for (int i: ab) {
        if (a.count(i) && !b.count(i) || b.count(i) && !a.count(i)) {
            cout << i << " ";
        }
    }
    cout << endl;
    return 0; 
}
