#include <iostream>
#include <set>
using namespace std;

const int max_n = 1000;
multiset<int> mst;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n, m, ta;

	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		cin >> ta;
		mst.insert(ta);
	}
	for (int i = 0; i < m; i++)
	{
		cin >> ta;
		mst.insert(ta);
	}

	for (int i = 0; i <= max_n; i++)
	{
		if (mst.count(i) == 1)
			cout << i << " ";
	}
	cout << endl;
	
	return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define vec vector<int>
#define vecp vector<pair<int,int>>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fr first
#define sc second
#define fr1(i,a,b) for(int i=a;i<b;i++)
#define fr2(i,a,b) for(int i=a;i>=b;i--)
#define fr3(i,a,b) for(int i=a;i<=b;i++)
#define umap unordered_map<int,int,custom_hash>
#define omap map<int,int>
#define uset unordered_set<int,custom_hash>
#define oset set<int>
#define pr pair<int,int>
#define mod 1000000007
#define mp make_pair
#define all(v) v.begin(),v.end()
#define ppb pop_back

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

void solve()
{
  int n,m;
  cin>>n>>m;
  map<int,int> map1;
  fr1(i,0,n)
  {
    int x;
    cin>>x;
    map1[x]++;
  }
  fr1(i,0,m)
  {
    int x;
    cin>>x;
    map1[x]++;
  }
  for(auto i:map1)if(i.sc==1)cout<<i.fr<<" ";
  cout<<"\n";

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    fr3(i,1,t){
      //cout<<"Case: "<<t<<;
        solve();
    }
   return 0;
}