#include<bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = pair <int, int>;

const int N = 1e3 + 7;

int main () {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL
  freopen("in.txt", "r", stdin);
#endif
  int n, m; cin >> n >> m;
  vector <bool> a(N), b(N);
  for (int i = 0; i < n; ++i) {
    int x; cin >> x;
    a[x] = 1;
  }
  for (int i = 0; i < m; ++i) {
    int x; cin >> x;
    b[x] = 1;
  }
  for (int i = 1; i < N; ++i) {
    if (a[i] == 0 and b[i]) {
      cout << i;
    } else if (b[i] == 0 and a[i]) {
      cout << i;
    }
    cout << " ";
  }
  return 0;
}
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct fast_ios { fast_ios(){ cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); }; } fast_ios_;
const int INF = (int)1e9;
const ll INFL = (ll)1e18;
const int MOD = 1e9 + 7;
const double EPS = 1e-10;
int dx[]={0, 0, -1, 1};
int dy[]={1, -1, 0, 0};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main()
{
    int n, m;
    cin >> n >> m;
    map<int, int> mp;
    vector<int> ans;
    rep(i,n)
    {
        int a;
        cin >> a;
        mp[a]++;
    }
    rep(i,m)
    {
        int b;
        cin >> b;
        mp[b]++;
    }

    for (auto p : mp)
    {
        if (p.second == 1)
            ans.push_back(p.first);
    }
    sort(ans.begin(), ans.end());

    for (auto p : ans)
        cout << p << " ";
    cout << endl;
    return 0;
}
