#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << '\n'; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin, n, m;
    vector<ll> h(n), w(m);
    REP(i, 0, n) {
        cin, h[i];
    }
    REP(i, 0, m) {
        cin, w[i];
    }
    sort(h.begin(), h.end());
    sort(w.begin(), w.end());
    int half = (n + 1) / 2;
    vector<ll> hodd(half + 1, 0), heven(half + 1, 0);
    REP(i, 0, half) {
        hodd[i + 1] = hodd[i] + h[i * 2];
        if (i + 1 != half) {
            heven[i + 1] = heven[i] + h[i * 2 + 1];
        }
    }
    ll ans = 1LL << 60;
    auto calc = [&](int pos, ll ww) -> ll {
        if (pos % 2) {
            pos /= 2;
            return -hodd[pos + 1] + hodd[half] - hodd[pos + 1] + heven[pos] - heven[half - 1] + heven[pos] + ww;
        } else {
            pos /= 2;
            return -hodd[pos] + hodd[half] - hodd[pos] - heven[half - 1] + heven[pos] + heven[pos] - ww;
        }
    };
    REP(i, 0, m) {
        int pos = lower_bound(h.begin(), h.end(), w[i]) - h.begin();
        chmin(ans, calc(pos, w[i]));
    }
    print(ans);

    return 0;
}

#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define repc(i, m, n) for (int i = m; i < n; i++)
#define reprc(i, m, n) for (int i = m; i > n; i--)
#define all(v) v.begin(), v.end()
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

int main()
{
	int a,b,c;

	cin >> a >> b >> c;

	cout << a + b + c - min(a, min(b, c)) << endl;
}