#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repm(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define repm2(i, s, n) for (int i = (int)(n - 1); i >= (s); i--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using ll = long long; // more than 10^9
using P = pair<int, int>;
const int INF = 0x3fffffff;
template <typename T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <typename T>
bool chmin(T &a, const T &b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

int main()
{
    int n, m;
    int a, b;
    vector<int> ans;
    unordered_set<ll> a_s, b_s, cap, cup, ans_s;

    cin >> n >> m;

    rep(i, n)
    {
        cin >> a;
        a_s.insert(a);
        cup.insert(a);
    }

    rep(i, m)
    {
        cin >> b;
        b_s.insert(b);
        cup.insert(b);

        if (a_s.count(b))
        {
            cap.insert(b);
        }
    }

    for (auto as : a_s)
        if (cup.count(as) && !cap.count(as))
            ans_s.insert(as);

    for (auto bs : b_s)
        if (cup.count(bs) && !cap.count(bs))
            ans_s.insert(bs);

    for (auto an : ans_s)
        ans.push_back(an);

    sort(ans.begin(), ans.end());

    rep(i, ans.size())
            cout
        << ans.at(i) << endl;

    return 0;
}

#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

template<class T>
bool UpdateMax(T &a, const T &b){
  if(a<b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template<class T>
bool UpdateMin(T &a, const T &b){
  if(a>b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int n,m;
  cin>>n>>m;
  vector<bool> a(1001, false), b(1001, false);
  vector<int> results;
  for(int i=0;i<n;i++){
    int v;
    cin>>v;
    a[v]=true;
  }
  for(int i=0;i<m;i++){
    int v;
    cin>>v;
    b[v]=true;
  }


  for(int i=1;i<=1000;i++){
    if(a[i]!=b[i]) results.push_back(i);
  }
  if(results.empty()) return 0;
  OutVec(results);

  return 0;
}