#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <queue>

#define	INF   1010101010LL
#define INFLL 1010101010101010101LL

using namespace std;

const int mod = 1000000007;
//const int mod = 998244353;

int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> a(n), b(m);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> b[i];
	}

	vector<int> ans;
	for (int i = 0; i < n; i++) {
		bool ok = true;
		for (int j = 0; j < m; j++) {
			if (a[i] == b[j]) {
				ok = false;
				break;
			}
		}
		if (ok) {
			ans.emplace_back(a[i]);
		}
	}
	for (int i = 0; i < m; i++) {
		bool ok = true;
		for (int j = 0; j < n; j++) {
			if (b[i] == a[j]) {
				ok = false;
				break;
			}
		}
		if (ok) {
			ans.emplace_back(b[i]);
		}
	}
	sort(ans.begin(), ans.end());
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i] << (i + 1 == ans.size() ? "\n" : " ");
	}

	return 0;
}
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <cmath>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;

int main() {
  int n, m;
  cin >> n >> m;
  set<int> a;
  set<int> b;
  int x;
  int sa, sb, ga, gb;
  rep(i, n) {
    cin >> x;
    a.insert(x);
    if (i == 0) sa = x;
    if (i == n-1) ga = x;
  }
  rep(i, m) {
    cin >> x;
    b.insert(x);
    if (i == 0) sb = x;
    if (i == m-1) gb = x;
  }
  bool fa, fb;
  int count = 0;
  for (int i = min(sa, sb); i <= max(ga, gb); i++) {
    fa = false; fb = false;
    if ((a.count(i) && !b.count(i)) || (!a.count(i) && b.count(i))) {
      if (count != 0) cout << " ";
      cout << i;
      count++;
    }
  }
  cout << endl;
}
