#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rrep(i,n) for(int i=((n)-1);i>=0;--i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
#define mod 1000000007
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n,m;
    cin>>n>>m;
    vector<bool> a(1010),b(1010);
    int c;
    rep(i,n){
        cin>>c;
        a[c]=true;
    }
    rep(i,m){
        cin>>c;
        b[c]=true;
    }
    rep(i,1010){
        if((a[i]&&!b[i])||(!a[i]&&b[i])) cout<<i<<" ";
    }
}
// Murabito-B 21/04/17
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    map<int, int> mp;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        mp[a[i]]++;
    }
    vector<int> ans;
    for (int i = 0, x; i < m; ++i) {
        cin >> x;
        if (mp[x] == 0) ans.push_back(x);
        mp[x]++;
    }
    for (int i = 0; i < n; ++i) {
        if (mp[a[i]] == 1) ans.push_back(a[i]);
    }
    sort(ans.begin(), ans.end());
    for (int x : ans) cout << x << " ";
}
int main() {
    ios_base::sync_with_stdio(false), cin.tie(0);
    solve();
    return 0;
}