https://ac.nowcoder.com/acm/contest/29320/E
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll b,c,S=0;
priority_queue <int,vector<int>,less<int> >q;
int main()
{
int n,k; cin>>n>>k;
ll a[n];
for (int i=0 ;i<n;i++ ) {
cin>>a[i];
S+=a[i];
}
//cout<<S<<endl;
for (int j=0 ;j<n;j++ ) {
cin>>b;
c=a[j]-b; //
q.push(c);
}
while( k-- ) {
ll t=q.top(); q.pop();
if(t>=0)
S-=t;
else
break;
}
cout<<S<<"\n";
return 0;
}