#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPR(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define FORR(i, m, n) for (int i = (int)n - 1; i >= (int)m; i--)
#define REPE(i, v) for (auto i : v)
#define ALL(v) v.begin(), v.end()
#define endl "\n"
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
using LD = long double;
using VI = vector<int>;
using VVI = vector<vector<int> >;
using PII = pair<int, int>;
using MII = map<int, int>;
using SI = set<int>;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<vector<T> >;
template <typename T> using VVV = vector<vector<vector<T> > >;
void print() {cout << endl;}
template <typename Head, typename... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <typename T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <typename T> void print(vector<vector<T> > &df) { for (auto& vec : df) { print(vec);}}
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <typename T> void SORT (T &v) {sort(v.begin(), v.end());}
template <typename T> void SORTR (T &v) {sort(v.begin(), v.end(), greater<>());}
template <typename T> T GCD(T x,T y) {return __gcd(x,y);}
template <typename T> T LCM(T x,T y) {return x/__gcd(x,y)*y;}
template <typename T> int SZ(T v) {return v.size();}
template <typename T> T PCNT(T x) {return __builtin_popcountll(x);}
template <typename T> T BIT(T x) {return 1LL<<(x);}
int MOD = 1000000007;
int INF = 2000000000;
long double PI = acosl(-1);


int32_t main() {
    chrono::system_clock::time_point start_time, end_time;
    start_time = chrono::system_clock::now();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    int N, M;
    cin >> N;
    vector<int> A(N);
    cin >> M;
    vector<int> B(M);
    MII m;
    REP (i, N) {
        cin >> A[i];
        m[A[i]]++;
    }
    REP (i, M) {
        cin >> B[i];
        m[B[i]]++;
    }
    set<int> s;
    REP (i, N) {
        if (m[A[i]] == 1) {
            s.insert(A[i]);
        }
    }
    REP (i, M) {
        if (m[B[i]] == 1) {
            s.insert(B[i]);
        }
    }
    for (auto i : s) {
        cout << i << ' ';
    }
    cout << endl;

    
    


    end_time = chrono::system_clock::now();
    assert(chrono::duration_cast<chrono::milliseconds>(end_time-start_time).count() < 6000);
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/jsc2021/jsc2021_b && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/jsc2021/jsc2021_b && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/jsc2021/jsc2021_b && sh shellscripts/submit_cpp.sh
*/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define ZERO(c) memset(c, 0, sizeof(c))
using ll = long long;
using P = pair<int,int>;
 
const int INF = 1e9 + 5;
const ll INFL = 1e18 + 5;

int N, M, a,b,c;
set<int> A, B, C;
vector<int> v(3000);

int main() {
    cin >> N >> M;
    rep(i,N) {
        cin >> a;
        A.insert(a);
    }

    rep(i,M) {
        cin >> b;
        B.insert(b);
    }

    for (auto elem : A) {
        if (B.count(elem) == 0) C.insert(elem);
    }

    for (auto elem : B) {
        if (A.count(elem) == 0) C.insert(elem);
    }

    for (auto elem : C)
        cout << elem << endl;
}

