#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  return (a.first - a.second) < (b.first - b.second);
}
int main() {
  long long n, k;
  cin >> n >> k;
  pair<long long, long long> a[n];
  for (long long i = 0; i < n; i++) {
    long long temp;
    cin >> temp;
    a[i] = make_pair(temp, 0);
  }
  for (long long j = 0; j < n; j++) {
    long long temp;
    cin >> temp;
    a[j].second = temp;
  }
  sort(a, a + n, cmp);
  long long i = 0;
  long long sum = 0;
  while ((k > 0 || (a[i].first - a[i].second) <= 0) && i < n) {
    sum += a[i].first;
    i++;
    if (k > 0) {
      k--;
    }
  }
  while (i < n) {
    sum += a[i].second;
    i++;
  }
  cout << sum;
}
