#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, num, sum = 0, t, f = 0;
  cin >> n >> k;
  vector<int> a, b;
  for (i = 0; i < n; i++) {
    cin >> num;
    a.push_back(num);
  }
  for (i = 0; i < n; i++) {
    cin >> num;
    b.push_back(num);
  }
  multimap<int, int> difference;
  multimap<int, int>::reverse_iterator rit;
  multimap<int, int>::iterator it_ad;
  for (i = 0; i < n; i++) {
    difference.insert(make_pair(b[i] - a[i], min(a[i], b[i])));
  }
  for (rit = difference.rbegin(); rit != difference.rend(); rit++) {
    if (k > 0) {
      if (rit->first < 0)
        sum += (-1 * rit->first) + rit->second;
      else
        sum += rit->second;
      k--;
    } else {
      sum += rit->second;
    }
  }
  cout << sum;
}
