#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, pair<long long, long long> > > v;
long long arr[200010];
long long brr[200010];
int main() {
  long long n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> brr[i];
  }
  for (int i = 0; i < n; i++) {
    long long kk = arr[i] - brr[i];
    v.push_back(make_pair(kk, make_pair(arr[i], brr[i])));
  }
  sort(v.begin(), v.end());
  long long res = 0;
  int ii;
  for (ii = 0; ii < k; ii++) {
    res += v[ii].second.first;
  }
  while (ii < n && v[ii].first < 0) {
    res += v[ii].second.first;
    ii++;
  }
  while (ii < n) {
    res += v[ii].second.second;
    ii++;
  }
  cout << res << endl;
}
