#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   const long long linf = 0x3f3f3f3f3f3f3f3f;   const int maxn = 2e5 + 11;   const int maxm = 600 + 11;   const int mod = 1e9 + 7;   const double eps = 1e-5;   inline long long rd() {     long long x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   inline long long qpow(long long a, long long b, long long p) {     long long res = 1;     while (b) {       if (b & 1) {         res *= a;         res %= p;       }       b >>= 1;       a = a * a % p;     }     return res;   }   inline long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   struct node {     long long a, b, c;     bool operator<(const node &o) const {       if (c != o.c) return c > o.c;       if (b != o.b) return b < o.b;       return a > o.a;     }   } t[maxn];   int n, k;   bool check(long long x) {     priority_queue<node> q;     for (int i = 1; i <= n; i++) {       q.push(t[i]);     }     for (int i = 0; i < k; i++) {       node o = q.top();       q.pop();       if (o.c < i) return false;       if (o.c >= k) return true;       o.a += x;       o.c = o.a / o.b;       q.push(o);     }     return true;   }   int main() {     n = rd(), k = rd();     for (int i = 1; i <= n; i++) {       t[i].a = rd();     }     for (int i = 1; i <= n; i++) {       t[i].b = rd();       t[i].c = t[i].a / t[i].b;     }     long long l = 0, r = 5e12, ans = -1;     while (l <= r) {       long long mid = l + r >> 1;       if (check(mid))         ans = mid, r = mid - 1;       else         l = mid + 1;     }     printf( %lld n , ans);   }   