#include <cstdio>
#include <algorithm>

static const int N = (int)1e5;

int n, k;
int a[N], b[N];
int p[N];
long long ans;

bool comp(const int &x, const int &y) {
    return a[x] < a[y];
}

int main() {
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);

    scanf("%d%d", &n, &k);

    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]), p[i] = i;

    for (int i = 0; i < n; i++)
        scanf("%d", &b[i]);

    std::sort(p, p + n, comp);

    for (int i = 0; i < k; i++)
        ans += a[p[i]] - b[p[i]];

    printf("%I64d", ans);

    return 0;
}
