#include <bits/stdc++.h>
namespace patch {
template <typename T>
std::string to_string(const T& n) {
  std::ostringstream stm;
  stm << n;
  return stm.str();
}
}  // namespace patch
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  int a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  vector<pair<int, pair<int, int> > > v;
  for (int i = 0; i < n; i++)
    v.push_back(make_pair(a[i] - b[i], make_pair(a[i], b[i])));
  sort(v.begin(), v.end());
  int ans = 0;
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (v[i].first <= 0) {
      ans += v[i].second.first;
      count++;
      continue;
    } else if (count < k) {
      ans += v[i].second.first;
      count++;
    } else
      ans += v[i].second.second;
  }
  cout << ans;
  return 0;
}
