//NiceDuck
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;
#define FILE "000"
#define foru(i,a,b) for(int i=(int)(a); i<=(int)(b); ++i)
#define ford(i,a,b) for(int i=(int)(a); i>=(int)(b); --i)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define MOD 1000000007
#define el "\n"
#define MAX 200005

int n,k;
struct Price
{
    ll bef,aft,del;
} p[MAX];

bool cmp(const Price &x, const Price &y)
{
    return x.del>y.del;
}

int main()
{
    fastio
    #ifndef ONLINE_JUDGE
    freopen(FILE ".inp","r",stdin);
    freopen(FILE ".out","w",stdout);
    #endif // ONLINE_JUDGE
    
    cin>>n>>k;
    foru(i,1,n)cin>>p[i].bef;
    foru(i,1,n)
    {
        cin>>p[i].aft;
        p[i].del=p[i].aft-p[i].bef;
    }
    sort(p+1,p+n+1,cmp);
    ll ans=0;
    foru(i,1,n)
    {
        if(i<=k) ans+=p[i].bef;
        else
        {
            if(p[i].del>=0) ans+=p[i].bef;
            else ans+=p[i].aft;
        }
    }
    cout<<ans;
    
    return 0;
}