#include <bits/stdc++.h>

using namespace std;

// ******************* SNIPPET TEMPLATE - STARTS***************
#define range(t) for (int i = 0; i < t; i++)
#define rep(i, t, q) for (int i = t; i < q; i++)
#define pb(t) push_back(t)
#define rangeG(i, t) for (i = 0; i < t; i++)
#define printVec(vec)      \
    for (auto c : vec)     \
    {                      \
        cout << c << endl; \
    }

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;

template <typename first>
void print(first f)
{
    cout << f << endl;
}

template <typename first, typename... args>
void print(first f, args... a)
{
    cout << f << " ";
    print(a...);
}

int inp(string s = "")
{
    cout << s;
    int t = 0;
    cin >> t;
    return t;
}
// X--------------X---------X SNIPPET TEMPLATE - ENDS* X--------------X---------X

void solve()
{
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    set<int> a, b;
    range(n)
    {
        int temp;
        cin >> temp;
        a.insert(temp);
    }

    range(m)
    {
        int temp2;
        cin >> temp2;
        b.insert(temp2);
    }
    //sort(a.begin(), a.end());
    //sort(b.begin(), b.end());
    
    set<int> result;
    for (int ax : a) {
        if (count(b.begin(), b.end(), ax) == 0) {
            result.insert(ax);
        }
    }

    for (int bx : b) {
        if (count(a.begin(), a.end(), bx) == 0) {
            result.insert(bx);
        }
    }
    //sort(result.begin(), result.end());
    for (int ans : result) {
        cout << ans << " ";
    }
    cout << "\n";
    return 0;
}
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <numeric>
#include <chrono>
#include <random>
#include <bitset>
#include <tuple>
#include <queue>
#include <map>
#include <unordered_map>
#include <cstring>
#include <cassert>
#include <climits>
#include <complex>
#include <math.h>
using namespace std;

const int N = 2e5 + 10, mod = 1e9 + 7;

int main() {
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tc = 1;
    for(int cn = 1; cn <= tc; cn++) {
        int n, m; cin >> n >> m;
        vector<int> res;
        vector<bool> a(N, 0), b(N, 0);
        for(int i = 0; i < n; i++) {
            int x; scanf("%d", &x);
            a[x] = 1;
        }
        for(int i = 0; i < m; i++) {
            int x; scanf("%d", &x);
            b[x] = 1;
        }

        for(int i = 1; i <= 1e3; i++) {
            if(a[i] ^ b[i]) cout << i << ' ';
        }
        cout << endl;
    }
    return 0;
}
