#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  pair<int, int> profit[n];
  int t = 0;
  for (int i = 0; i < n; i++) {
    profit[i].first = b[i] - a[i];
    if (profit[i].first > 0) t++;
    profit[i].second = i;
  }
  sort(profit, profit + n);
  reverse(profit, profit + n);
  t = max(t, k);
  int ans = 0;
  for (int i = 0; i < t; i++) ans += a[profit[i].second];
  for (int i = t; i < n; i++) ans += b[profit[i].second];
  cout << ans;
}
