#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD = 1000000007;
#define fr(i, n) for (i = 0; i < n; i++)
#define rep(i, n) for (i = 1; i <= n; i++)
#define lcm(x, y) ((x) * (y) / __gcd((x), (y)))
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define debug(x) cout << #x << " : " << x << endl
#define part cout << "----------------------------------\n";
#include <iostream>
#define intCeil(a, b) ((a) + (b)-1) / (b)
const LL INF = 1e14;

int dx[] = {1, 1, 0, -1, -1, -1, 0, 1}; // trick to explore an implicit 2D grid
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1}; // S,SE,E,NE,N,NW,W,SW neighbors  //GO FOR EVEN FOR 4 moves

#define fastinput                     \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

LL POW(LL x, LL y)
{
    LL ans = 1;
    LL base = x;
    while (y)
    {
        if (y & 1)
        {
            ans *= base;
        }
        base = base * base;
        y = y >> 1;
    }
    return ans;
}
vector<LL> choices;

LL get_closest(LL num)
{
    LL lb = 0, ub = choices.size() - 1;
    LL mid;

    LL ans_l = choices[0];
    LL ans_r = choices[ub];
    while (lb <= ub)
    {
        mid = (lb + ub) / 2;
        if (choices[mid] <= num)
        {
            ans_l = choices[mid];
            lb = mid + 1;
        }
        else
        {
            ub = mid - 1;
        }
    }

    lb = 0, ub = choices.size() - 1;
    while (lb <= ub)
    {
        mid = (lb + ub) / 2;
        if (choices[mid] >= num)
        {
            ans_r = choices[mid];
            ub = mid - 1;
        }
        else
        {
            lb = mid + 1;
        }
    }

    if (fabs(ans_l - num) < fabs(ans_r - num))
    {
        return ans_l;
    }
    else
    {
        return ans_r;
    }
}
int main()
{
    fastinput;
    LL n, i, j, k, t, temp, tc;
    LL m;
    cin >> n >> m;
    vector<LL> v(n), sum1(n, 0), sum2(n, 0);
    for (i = 0; i < n; i++)
    {
        cin >> v[i];
    }

    sort(all(v));

    for (i = 0; i < n; i++)
    {
        if (i == 0)
        {
            sum1[i] = v[i];
        }
        else
        {
            if (i & 1)
            {
                sum2[i] = sum2[i - 1] + v[i];
                sum1[i] = sum1[i - 1];
            }
            else
            {
                sum2[i] = sum2[i - 1];
                sum1[i] = sum1[i - 1] + v[i];
            }
        }
    }

    for (i = 0; i < m; i++)
    {
        cin >> j;
        choices.pb(j);
    }

    choices.pb(-INF);
    choices.pb(INF);

    sort(all(choices));
    LL best_now = 1e17;
    for (i = 0; i < n; i += 2)
    {
        LL pos = i;
        LL num2 = get_closest(v[pos]);
        LL a = fabs(num2 - v[i]);
        if (i != 0)
        {
            a += fabs(sum1[i - 1] - sum2[i - 1]);
        }

        if (i != n - 1)
        {
            a += fabs((sum1[n - 1] - sum1[i]) - (sum2[n - 1] - sum2[i]));
        }

        best_now = min(best_now, a);
    }

    cout << best_now << endl;

    return 0;
}

#include<bits/stdc++.h>

#define int long long
#define pb push_back
#define range(v) v.begin(),v.end()
#define rrange(v) v.rbegin(), v.rend()
#define mod (int)(1e9 + 7)
#define inf (int)(1e17)
#define N (int)(2e5 + 10)

using namespace std;

void solve() {
	int n, m;
	cin >> n >> m;
	vector<int> a(n), b(m);
	for (int &i : a) cin >> i;
	for (int &i : b) cin >> i;
	sort(range(a));
	sort(range(b));
	vector<int> pref(n + 1);
	for (int i = 1; i <= n; i++)
		pref[i] = pref[i - 1] + (i & 1 ? -a[i - 1] : a[i - 1]);
	int ans = inf;
	auto trans = [&](int x) {
		int i = upper_bound(range(a), x) - begin(a);
		int ans = 2 * pref[i] - pref[n];
		if (i & 1) ans += x;
		else ans -= x;
		return ans;
	};

	for (int i : b)
		ans = min(ans, trans(i));
	cout << ans << endl;
}


// Got stuck and want to leave ? look at the bottom once..
int32_t main() {
	ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
	int t_c = 1;
	// cin >> t_c;
	while (t_c--)
		solve();
}
/*
 * LOOK DUDE ... IT AINT DEFINETELY EASY BUT YOU AINT THAT WEAK EITHER
 * COME ON DUDE .... DONT GET UP UNTIL U GET THE SOLUTION
 * GIVING UP NOT GONNA HELP .. JUST GET YOUR ASS TO WORK ALREADY ..
 * AND FOR FUCKING SAKE ... DONT PANIC !!
*/
