#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
struct node {
  int x;
  int y;
  int z;
} nod[2 * maxn + 10];
bool cmp(node a, node b) { return a.z < b.z; }
int main() {
  int n, k, ans = 0;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &nod[i].x);
  for (int i = 0; i < n; i++) {
    scanf("%d", &nod[i].y);
    nod[i].z = nod[i].x - nod[i].y;
  }
  sort(nod, nod + n, cmp);
  for (int i = 0; i < n; i++)
    if (i < k)
      ans += nod[i].x;
    else {
      if (nod[i].z < 0)
        ans += nod[i].x;
      else
        ans += nod[i].y;
    }
  printf("%d\n", ans);
  return 0;
}
