/* dont stick to an approach */
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>
#include <numeric>
#include <cstdlib>

using namespace std;

typedef long long ll;
typedef unsigned long long int ull;
typedef long double ldb;

#define PB push_back

#define For(i, n) for (ll i = 0; i < n; i++)

#define trav(a,x) for (auto& a : x)

#define PYES cout<<"YES\n"
#define PNO cout<<"NO\n"
#define PYes cout<<"Yes\n"
#define PNo cout<<"No\n"
#define endl '\n'

#define sq(x)           (x*x)

#define vll             vector<ll>
#define rev(v)          reverse(v.begin(),v.end())
#define srt(v)          sort(v.begin(),v.end())
#define grtsrt(v)       sort(v.begin(),v.end(),greater<int>())
#define mnv(v)          *min_element(v.begin(),v.end())
#define mxv(v)          *max_element(v.begin(),v.end())
#define all(v)          v.begin(),v.end()

#define Fas ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

//--------------------------------------------functions-------------------------------------------------//

ll power(ll a,ll b){ll result=1;while(b>0){if(b%2 == 1){result *= a;} a *= a;b /= 2;}return result;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
ll countSetBits(ll x){ll Count=0;while(x>0){if(x&1) Count++;x=x>>1;}return Count;}
bool isPerfectSquare(ll n){ll sr = sqrt(n);if (sr * sr == n)return true;else return false;}
ll mod(ll x,ll M){return ((x%M + M)%M);}
ll add(ll a, ll b,ll M){return mod(mod(a,M)+mod(b,M),M);}
ll mul(ll a, ll b,ll M){return mod(mod(a,M)*mod(b,M),M);}
ll powerM(ll a,ll b,ll M){
    ll res=1ll;
    while(b){
        if(b%2ll==1ll){
            res=mul(a,res,M);
        }
        a=mul(a,a,M);b/=2ll;
    }
    return res;
}
//------------------------------------sieve of erantothenes-----------------------------------------------//
//ll MAXN=1e7+100;
//vector<ll> fact(MAXN);
//void sieve_of_erantothenes()
//{
//    fact[1] = 1;
//    for (ll i = 2; i <= MAXN; i++)
//        fact[i] = i;
//    for (ll i = 4; i <= MAXN; i += 2)
//        fact[i] = 2;
//    for (ll i = 3; i * i <= MAXN; i++){
//        if (fact[i] == i){
//            for (ll j = i * i; j <= MAXN; j += i)
//                if (fact[j] == j)
//                    fact[j] = i;
//        }
//    }
//}
//----------------------------------------nCr mod------------------------------------------------------//
ll modInverse(ll n,ll M){
    return powerM(n,M-2,M);
}
ll nCrM(ll n,ll r,ll M){
    if(n<r) return 0;
    if(r==0) return 1;
    vector<ll> fact(n+1);
    fact[0]=1;
    for(ll i=1;i<=n;i++){
        fact[i]=mul(fact[i-1],i,M);
    }
    return mul(mul(fact[n],modInverse(fact[r],M),M),modInverse(fact[n-r],M),M);
}
//-----------------------------------------------solve-----------------------------------------------------//
void solve(){
    set<ll> sa,sb;
    ll n,m;cin>>n>>m;
    for(ll i=0;i<n;i++){
        ll a;cin>>a;
        sa.insert(a);
    }
    for(ll i=0;i<m;i++){
        ll a;cin>>a;
        sb.insert(a);
    }
    set<ll> ans;
    trav(w, sa){
        if(sb.find(w)==sb.end()){
            ans.insert(w);
        }
    }
    trav(w, sb){
        if(sa.find(w)==sa.end()){
            ans.insert(w);
        }
    }
    trav(w,ans){
        cout<<w<<" ";
    }
    cout<<endl;
}
 

int main(){
    Fas;

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

//    ll t=0;
//    cin>>t;
//    while(t--)
        solve();

    return 0;
}

// Problem: E - Divide Both
// Contest: AtCoder - AtCoder Beginner Contest 206（Sponsored by Panasonic）
// URL: https://atcoder.jp/contests/abc206/tasks/abc206_e
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;
#define ll long long
#define pi pair<int,int>
#define pll pair<ll,ll>
#define ld  long double
#define vi vector<int> 
#define vll vector<ll> 
#define vvll vector<vector<ll>> 
#define vvi vector<vector<int>> 
#define vs vector<string>
#define vpll vector<pll>
#define vpi vector<pi>
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define all(c)  (c).begin(),(c).end()
#define sz(c) int((c).size())
#define MP make_pair

#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define FORI(i, a, b) for(int i = (a); i >= (b); i--)

const int INF = 1e9 + 7;
const long long MOD = 1e9 + 7;

// credits : tourist 
string to_string(string s) {return '"' + s + '"';}string to_string(const char* s) {return to_string((string) s);}string to_string(bool b) {return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v) {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res += ", ";}first = false;res += to_string(x);}res += "}";return res;}void debug_out() { cerr << "\n"; }template <typename Head, typename... Tail>void debug_out(Head H, Tail... T) {cerr << " " << to_string(H) << "\n";debug_out(T...);} 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
ll gcd(ll x , ll y){
    if(y == 0)  return x;
    if(x == 0)  return y;
    if(x < y) swap(x , y);
    return gcd(x % y , y);
}

const int N = 1e6 + 8;

ll dp[N]; /* number of pairs with gcd = g*/

ll brute(int L , int R, int g){
   ll p = 0;
   for(int i = L; i <= R; i++){
      for(int j = i + 1; j <= R; j++){
         p += gcd(i , j) == g;
      }
   }
   return p;
}
void solve(){
   int L , R;
   cin >> L >> R;
   
   for(int g = R;  g >= 1; g--){
      int cnt = 0;
      for(int m = g; m <= R; m += g){
         if(m != g) {
            dp[g] -= dp[m];
         }
         if(m >= L) cnt++;
      }
      ll val = 1LL * cnt * (cnt - 1) / 2;
      dp[g] += val;
   }
   
   ll ans = 0;
   for(int g = 2; g <= R; g++){
      ll val = dp[g];
      ll remove = 0;
      if(g >= L) remove = (R / g) - 1;
      
      ans += 2LL * (val - remove);
   }
   cout << ans << endl;
}

int main(){
    ios :: sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr);

    int tt = 1;
    // cin >> tt;

    #ifdef SIEVE
    construct();
    #endif

    #ifdef NCR
    compute_combinations_table(MOD);
    #endif

    #ifdef FACTORIALS
    compute_factorials(MOD);
    #endif

    for(int tc = 1; tc <= tt; tc++){
        // cout << "Case #" << tc << ": ";
        solve();
    }
}