#include <bits/stdc++.h>
using namespace std;
long long int s[234567];
long long int t[234567];
vector<pair<long long int, long long int> > v;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  ;
  long long int n, k, sum = 0;
  cin >> n >> k;
  for (long long int i = 0; i < n; i++) cin >> s[i];
  for (long long int i = 0; i < n; i++) cin >> t[i];
  for (long long int i = 0; i < n; i++) {
    long long int a1 = s[i];
    long long int a2 = t[i];
    v.push_back({a2 - a1, i});
  }
  sort(v.rbegin(), v.rend());
  for (long long int i = 0; i < k; i++) sum += s[v[i].second];
  for (long long int i = k; i < v.size(); i++) {
    long long int ind = v[i].second;
    if (v[i].first > 0)
      sum += s[ind];
    else
      sum += t[ind];
  }
  cout << sum << "\n";
}
