#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef unordered_map<int, int> uii;
typedef unordered_map<ll, ll> ull;
#define mp make_pair
#define pb push_back
#define PB pop_back
#define F first
#define S second
#define Endl '\n'
const int mod = 1e9+7;

void call()
{ 
  ll n,m;
  cin >> n >> m;
  unordered_map<ll,ll>m1;
  unordered_map<ll,ll>m2;
  set<ll>s;
  for(ll i=0;i<n;++i)
  {
    ll tmp;
    cin >> tmp;
    m1[tmp]++;
  }
  for(int i=0;i<m;++i)
  {
    ll  tmp;
    cin >> tmp;
    m2[tmp]++;
  }
  for(auto&it:m1)
  {
    if(m2.find(it.first)==m2.end())
    {
      s.insert(it.first);
    }
  }
  for(auto&it:m2)
  {
    if(m1.find(it.first)==m1.end())
    {
      s.insert(it.first);
    }
  }
  for(auto&it:s)
  {
    cout << it << " ";
  }
  cout << endl;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int TC;TC=1;
	
	while(TC--)
		call();
	
	return 0;
}

#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;
    int a[n], b[m];
    rep(i, n) cin >> a[i]; 
    rep(i, m) cin >> b[i];

    set<int> ans;
    

    rep(i, n){
        bool flag = true;
        rep(j, m){
            if(a[i] == b[j]) flag = false;
        }
        if(flag) ans.insert(a[i]);
    }
    rep(j, m){
        bool flag = true;
        rep(i, n){
            if(a[i] == b[j]) flag = false;
        }
        if(flag) ans.insert(b[j]);
    }
    for(auto x:ans) cout << x << ' ';
    cout << endl;
}
