#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  long long k;
  cin >> n;
  cin >> k;
  vector<long long> d(n);
  vector<long long> afterd(n);
  for (long long i = 0; i < n; i++) cin >> d[i];
  for (long long i = 0; i < n; i++) cin >> afterd[i];
  vector<pair<long long, long long> > utility(n);
  for (long long i = 0; i < n; i++) {
    utility[i].first = d[i] - afterd[i];
    utility[i].second = i;
  }
  sort(utility.begin(), utility.end());
  set<long long> u2;
  long long p = 0;
  while (k > 0 || utility[p].first < 0) {
    u2.insert(utility[p].second);
    p += 1;
    k -= 1;
  }
  long long cost = 0;
  for (long long i = 0; i < n; i++) {
    if (u2.find(i) != u2.end())
      cost += d[i];
    else
      cost += afterd[i];
  }
  cout << cost;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
