#include <bits/stdc++.h>
using namespace std;
int n, k, i, res;
int a[210000], b[210000], d[210000];
int main() {
  cin >> n >> k;
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) res += a[i];
  for (i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (i = 1; i <= n; i++) d[i] = b[i] - a[i];
  sort(d + 1, d + n + 1);
  k = n - k;
  i = 1;
  while (d[i] < 0 && k > 0 && i <= n) {
    res += d[i];
    i++;
    k--;
  }
  cout << res << endl;
}
