#include <bits/stdc++.h>
struct Item {
  int currentPrice;
  int futurePrice;
  int priceDifference;
};
int compareItems(const void *a, const void *b) {
  struct Item *firstItem = (struct Item *)a;
  struct Item *secondItem = (struct Item *)b;
  return secondItem->priceDifference - firstItem->priceDifference;
}
int main(void) {
  int n, k;
  scanf("%d %d", &n, &k);
  struct Item items[200000];
  for (int i = 0; i < n; i++) {
    int price;
    scanf("%d", &price);
    items[i].currentPrice = price;
  }
  for (int i = 0; i < n; i++) {
    int price;
    scanf("%d", &price);
    items[i].futurePrice = price;
    items[i].priceDifference = items[i].futurePrice - items[i].currentPrice;
  }
  qsort(items, n, sizeof(struct Item), compareItems);
  int moneyAmount = 0;
  for (int i = 0; i < k; i++) {
    moneyAmount += items[i].currentPrice;
  }
  for (int i = k; i < n; i++) {
    if (items[i].priceDifference > 0) {
      moneyAmount += items[i].currentPrice;
    } else {
      moneyAmount += items[i].futurePrice;
    }
  }
  printf("%d", moneyAmount);
  return 0;
}
