#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k;
  cin >> n >> k;
  long long int a[n], b[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long int i = 0; i < n; i++) {
    cin >> b[i];
  }
  vector<long long int> v;
  long long int sum = 0, c = 0;
  for (long long int i = 0; i < n; i++) {
    if (a[i] > b[i]) {
      v.push_back(a[i] - b[i]);
    } else {
      c++;
    }
    sum += a[i];
  }
  sort(v.begin(), v.end());
  if (c < k) {
    for (long long int i = k - c; i < v.size(); i++) {
      sum -= v[i];
    }
  } else {
    for (long long int i = 0; i < v.size(); i++) {
      sum -= v[i];
    }
  }
  cout << sum << endl;
  return 0;
}
