#include <bits/stdc++.h>
using namespace std;
int a[200005];
int b[200005];
pair<int, int> c[200005];
int main() {
  ios::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  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++) {
    c[i].first = a[i] - b[i];
    c[i].second = i;
  }
  sort(c, c + n);
  int ans = 0;
  for (int i = 0; i < k; i++) ans += a[c[i].second];
  int f = k;
  while (f < n && c[f].first <= 0) {
    ans += a[c[f].second];
    f++;
  }
  for (; f < n; f++) ans += b[c[f].second];
  cout << ans;
  return 0;
}
