#include <bits/stdc++.h>
using namespace std;
bool sortByDiff(const pair<int, int> &lhs, const pair<int, int> &rhs) {
  return lhs.first < rhs.first;
}
int main() {
  int n, k, i = 0;
  cin >> n >> k;
  int bd[n], ad[n];
  for (i = 0; i < n; i++) {
    cin >> bd[i];
  }
  for (i = 0; i < n; i++) {
    cin >> ad[i];
  }
  int price = 0, mi;
  i = 0;
  vector<pair<int, int> > diff;
  for (int i = 0; i < n; i++) {
    pair<int, int> d = {bd[i] - ad[i], i};
    diff.push_back(d);
  }
  sort(begin(diff), end(diff), sortByDiff);
  while (k > 0) {
    mi = diff[i].second;
    price += bd[mi];
    ad[mi] = 0;
    bd[mi] = 0;
    i++;
    k--;
  }
  while (i < n && diff[i].first < 0) {
    mi = diff[i].second;
    price += bd[mi];
    bd[mi] = 0;
    ad[mi] = 0;
    i++;
  }
  for (int i = 0; i < n; i++) {
    price += ad[i];
  }
  cout << price;
  return 0;
}
