#include <bits/stdc++.h>
using namespace std;
struct node {
  long diff;
  long index;
};
bool sortbydiff(struct node a, struct node b);
int main() {
  long n, k;
  cin >> n >> k;
  long arr1[n], arr2[n];
  for (long i = 0; i < n; i++) {
    cin >> arr1[i];
  }
  for (long i = 0; i < n; i++) {
    cin >> arr2[i];
  }
  struct node arr[n];
  long sum = 0, c = 0;
  for (long i = 0; i < n; i++) {
    long d = arr1[i] - arr2[i];
    arr[i].diff = d;
    arr[i].index = i;
  }
  sort(arr, arr + n, sortbydiff);
  long long i = 0;
  while (arr[i].diff <= 0 && i < n) {
    c++;
    sum += arr1[arr[i].index];
    i++;
  }
  while (i < n) {
    if (c < k) {
      c++;
      sum += arr1[arr[i].index];
    } else {
      sum += arr2[arr[i].index];
    }
    i++;
  }
  cout << sum;
}
bool sortbydiff(struct node a, struct node b) {
  if (a.diff == b.diff) {
    if (a.index < b.index) {
      return true;
    } else {
      return false;
    }
  }
  if (a.diff < b.diff) {
    return true;
  } else {
    return false;
  }
}
