#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M,P;
  cin >> N >> M;
  P=N+M;
  vector<int> A(P);
  for (int i=0;i<P;i++) {
    cin >> A.at(i);
  }
  sort(A.begin(),A.end());
  for (int i=0;i<P;i++) {
     if (i==0) {
       int a,b;
       a=A.at(0);
       b=A.at(1);
       if (a!=b) {
         cout << A.at(0) << " ";
       }
     }
    else if ((i>0)&&(i<P-1)) {
      int a,b,c;
      a=A.at(i-1);
      b=A.at(i);
      c=A.at(i+1);
      if ((a!=b)&&(b!=c)) {
        cout << A.at(i) << " ";
      }
    }
    else if (i==P-1) {
      int b,c;
      b=A.at(P-2);
      c=A.at(P-1);
      if (b!=c) {
        cout << A.at(P-1) << " ";
      }
    }
  }
}
///********************** Bismillahir Rahmanir Rahim *****************///
#include<bits/stdc++.h>
using namespace std;

///*********************** Template Start Here ***********************///
///************************ C o n t a i n e r ************************///
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<int>::iterator vit;
typedef set<int> si;
typedef set<string> ss;
typedef set<int>::iterator sit;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef map<int, string> mis;
typedef map<string, string> mss;
typedef pair<ll, ll> pll;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef double dl;

///**************************** M a r c o ****************************///
#define f first
#define s second
#define endl '\n'
#define sp <<" "<<
#define pb push_back
#define MP make_pair
#define MOD 1000000007
#define sqr(a) ((a) * (a))
#define sz(x) (int)x.size()
#define mid(l,r) ((l+r)/2)
#define fora(a) for(auto u:a)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a, b, sizeof(a))
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(auto i=0; i<n; i++)
#define rforn(i,n) for(auto i=n-1; i>=0; i--)
#define abid() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fori(a,b,c) {for(a = c.begin(); a!=b; a++) cout<< *a<< " "; cout<<endl;}

int main()
{
    abid();

    int n,m;
    cin>>n>>m;

    vi v(n),v1(m),ans(n+m);

    forn(i,n) cin>>v[i];
    forn(i,m) cin>>v1[i];
    vit st,it;
    it = set_symmetric_difference(all(v), all(v1), ans.begin());

    fori(st,it,ans);


    return 0;
}

