#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
template <class T>
inline T gcd(T x, T y) {
  return y ? gcd(y, x % y) : x;
}
template <class T>
inline T lcm(T x, T y) {
  return x / gcd(x, y) * y;
}
template <class T>
inline void adj(T &x, T y) {
  if (x >= y) x = x % y;
  while (x < 0) x = x + y;
}
template <class T>
inline T qpow(T x, long long y, T z) {
  for (; y; y >>= 1, x = x * x)
    if (y & 1) z = z * x;
  return z;
}
template <class T>
inline T mpow(long long w, T x, long long y, T z) {
  for (; y; y >>= 1, x = x * x, x = x % w)
    if (y & 1) z = z * x, z = z % w;
  return z;
}
template <class T>
inline T exgcd(T a, T b, T &x, T &y) {
  T t = a;
  b ? (t = exgcd(b, a % b, y, x), y = y - (a / b) * x) : (x = 1, y = 0);
  return t;
}
const long long MOD = 1000000007LL;
const int M = 5000005;
const int N = 200005;
int n, m;
long long a[N], c[N], b[N];
priority_queue<pair<long long, int>, vector<pair<long long, int> >,
               greater<pair<long long, int> > >
    pq, q;
bool judge(long long x) {
  int now = 0;
  q = pq;
  for (; now < m; now++) {
    pair<long long, int> t = q.top();
    q.pop();
    if (t.first < 1LL * now) return false;
    c[t.second] += x;
    q.push(make_pair(c[t.second] / b[t.second], t.second));
  }
  return true;
}
long long bs(long long l, long long r) {
  long long res = -1;
  while (l <= r) {
    long long m = (l + r) >> 1;
    memcpy((c), (a), sizeof((a)));
    if (judge(m))
      res = m, r = m - 1LL;
    else
      l = m + 1LL;
  }
  return res;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%lld", &b[i]);
  for (int i = 1; i <= n; i++) pq.push(make_pair(a[i] / b[i], i));
  printf("%lld\n", bs(0LL, 2000000000000LL));
  return 0;
}
