#include <bits/stdc++.h>   using namespace std;   struct PR {     int to;     int ne;   } Prise[200010];   bool compare(PR a, PR b) { return (a.to - a.ne) < (b.to - b.ne); }   int main(int argc, char const *argv[]) {     int n, k;     cin >> n >> k;     int i;     for (i = 0; i < n; i++) {       cin >> Prise[i].to;     }     for (i = 0; i < n; i++) {       cin >> Prise[i].ne;     }     sort(Prise, Prise + n, compare);     int count = 0;     for (i = 0; i < k; i++) {       count += Prise[i].to;     }     for (i = k; i < n; i++) {       if (Prise[i].to < Prise[i].ne) {         count += Prise[i].to;       } else {         count += Prise[i].ne;       }     }     cout << count << endl;     return 0;   }   