#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  vector<long long> b(n);
  vector<long long> c(n);
  long long sum1 = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
    sum1 += b[i];
  }
  for (long long i = 0; i < n; i++) {
    c[i] = b[i] - a[i];
  }
  sort(c.begin(), c.end());
  reverse(c.begin(), c.end());
  long long sum2 = 0;
  for (long long i = 0; i < k; i++) {
    sum2 += c[i];
  }
  for (long long i = k; i < n; i++) {
    if (c[i] > 0) sum2 += c[i];
  }
  cout << sum1 - sum2 << endl;
}
