#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;
}
I2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGFsZ29yaXRobT4KCnN0YXRpYyBjb25zdCBpbnQgTiA9IChpbnQpMWU1OwoKaW50IG4sIGs7CmludCBhW05dLCBiW05dOwppbnQgcFtOXTsKbG9uZyBsb25nIGFuczsKCmJvb2wgY29tcChjb25zdCBpbnQgJngsIGNvbnN0IGludCAmeSkgewogICAgcmV0dXJuIGFbeF0gPCBhW3ldOwp9CgppbnQgbWFpbigpIHsKICAgIGZyZW9wZW4oImlucHV0LnR4dCIsICJydCIsIHN0ZGluKTsKICAgIGZyZW9wZW4oIm91dHB1dC50eHQiLCAid3QiLCBzdGRvdXQpOwoKICAgIHNjYW5mKCIlZCVkIiwgJm4sICZrKTsKCiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykKICAgICAgICBzY2FuZigiJWQiLCAmYVtpXSksIHBbaV0gPSBpOwoKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKQogICAgICAgIHNjYW5mKCIlZCIsICZiW2ldKTsKCiAgICBzdGQ6OnNvcnQocCwgcCArIG4sIGNvbXApOwoKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgazsgaSsrKQogICAgICAgIGFucyArPSBhW3BbaV1dIC0gYltwW2ldXTsKCiAgICBwcmludGYoIiVJNjRkIiwgYW5zKTsKCiAgICByZXR1cm4gMDsKfQo=