#include <bits/stdc++.h>
using namespace std;
struct tov {
  int a, b;
};
bool cmp_tov(tov p1, tov p2) { return (p1.a - p1.b) < (p2.a - p2.b); }
int k, i, j, ans = 0, kol = 0, n;
int main() {
  cin >> n >> k;
  tov mas[n];
  for (i = 0; i < n; i++) cin >> mas[i].a;
  for (i = 0; i < n; i++) cin >> mas[i].b;
  sort(mas, mas + n, cmp_tov);
  i = 0;
  while (kol < k || (mas[i].a - mas[i].b) <= 0) {
    if (i == n) break;
    kol++;
    ans += mas[i].a;
    i++;
  }
  while (i < n) {
    ans += mas[i].b;
    i++;
  }
  cout << ans << endl;
}
