#include <bits/stdc++.h>
using namespace std;
struct node {
  int a, b, c;
} num[200010];
bool cmp(const struct node& aa, const struct node& bb) { return aa.c < bb.c; }
int main() {
  int n;
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> num[i].a;
  for (int i = 0; i < n; i++) {
    cin >> num[i].b;
    num[i].c = num[i].a - num[i].b;
  }
  sort(num, num + n, cmp);
  int cnt = k;
  long long ret = 0;
  for (int i = 0; i < n; i++) {
    if (cnt > 0) {
      ret += num[i].a;
      cnt--;
    } else {
      if (num[i].c < 0)
        ret += num[i].a;
      else
        ret += num[i].b;
    }
  }
  cout << ret << endl;
  return 0;
}
