#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> A;
vector<int> B;
vector<pair<int, int> > diffs;
int main() {
  cin >> n >> k;
  A.resize(n, 0);
  B.resize(n, 0);
  diffs.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> B[i];
  }
  for (int i = 0; i < n; i++) {
    diffs[i] = make_pair(B[i] - A[i], i);
  }
  priority_queue<pair<int, int> > diff_heap(diffs.begin(), diffs.end());
  int cantidad = 0;
  int diffActual = (diff_heap.top()).first;
  int dinero = 0;
  while (cantidad < k || diffActual > 0) {
    auto par = diff_heap.top();
    dinero += A[par.second];
    diff_heap.pop();
    cantidad++;
    if (diff_heap.size() == 0) {
      break;
    }
    diffActual = diff_heap.top().first;
  }
  while (diff_heap.size() != 0) {
    auto par = diff_heap.top();
    dinero += B[par.second];
    diff_heap.pop();
  }
  cout << dinero << "\n";
  return 0;
}
