#include <bits/stdc++.h>
using namespace std;
int main() {
  int total_items;
  int buy_now;
  scanf("%d %d", &total_items, &buy_now);
  vector<int> init_price;
  vector<int> price_difference;
  int n;
  for (int i = 0; i < total_items; i++) {
    cin >> n;
    init_price.push_back(n);
  }
  int all_finish_price = 0;
  for (int i = 0; i < total_items; i++) {
    cin >> n;
    price_difference.push_back(init_price[i] - n);
    all_finish_price += n;
  }
  sort(price_difference.begin(), price_difference.end());
  int i;
  for (i = 0; i < buy_now || (price_difference[i] < 0 && i < total_items);
       i++) {
    all_finish_price += price_difference[i];
  }
  printf("%d\n", all_finish_price);
}
