#include <bits/stdc++.h>
using namespace std;
const int maxn=5e5+10;
#define int long long
double a[maxn],b[maxn];
int n,k;
struct p{
    double a,b; double c;
    bool operator < (const p &tmp )    const{
        return c>tmp.c;
    }
};
bool isok(int mid)
{
    priority_queue<p>q;
    for(int i=1;i<=n;i++)
        if( a[i]/b[i]<k )    q.push( (p){a[i],b[i],a[i]/b[i]} );
    if( q.empty() )    return 1;
    for(int i=0;i<k;i++)
    {
        p now=q.top(); q.pop();
        if( now.c<i )    return 0;
        if( (now.a+mid)/now.b<k )
        {
            now.a+=mid,now.c=now.a/now.b;
            q.push(now);
        }
        if( q.empty() )    return 1;
    }
    return 1;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for(int i=1;i<=n;i++)    cin >> a[i];
    for(int i=1;i<=n;i++)    cin >> b[i];
    int l=0,r=2e12,mid,ans=-1;
    while( r>=l )
    {
        mid =l+r>>1;
        if( isok(mid) )    ans=mid,r=mid-1;
        else    l=mid+1;
    }
    cout << ans;
}