#include <bits/stdc++.h>
using namespace std;
inline long long fpow(long long n, long long k, int p = 998244353) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
inline long long inv(long long a, long long p = 998244353) {
  return fpow(a, p - 2, p);
}
inline long long addmod(long long a, long long val, long long p = 998244353) {
  {
    if ((a = (a + val)) >= p) a -= p;
  }
  return a;
}
inline long long submod(long long a, long long val, long long p = 998244353) {
  {
    if ((a = (a - val)) < 0) a += p;
  }
  return a;
}
inline long long mult(long long a, long long b, long long p = 998244353) {
  return (long long)a * b % p;
}
long long n, k;
long long a[(int)(2e5 + 5)], b[(int)(2e5 + 5)];
long long temp[(int)(2e5 + 5)];
bool check(long long x) {
  long long tick = 0;
  vector<long long> times[(int)(2e5 + 5)];
  for (int i = 1; i <= n; i++) {
    if (b[i] && a[i] / b[i] <= k) times[a[i] / b[i]].push_back(i);
    temp[i] = a[i];
  }
  long long i = tick;
  while (tick < k) {
    bool ok = true;
    for (; i < k; i++) {
      if (times[i].size() > 0) {
        ok = false;
        break;
      }
    }
    if (ok) return true;
    while (times[i].size() > 0) {
      long long idx = times[i].back();
      times[i].pop_back();
      temp[idx] = min(temp[idx] + x, (long long)(1e13));
      tick++;
      if (b[idx] && temp[idx] / b[idx] <= k) {
        times[temp[idx] / b[idx]].push_back(idx);
      }
      if (tick > i && times[i].size() && i < k - 1) return false;
    }
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> k;
  if (k == 1) {
    cout << 0 << "\n";
    return 0;
  }
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) cin >> b[i];
  long long l = 0, r = (long long)(2e12 + 5);
  while (l < r) {
    long long mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (l >= (long long)(2e12 + 5))
    cout << -1 << "\n";
  else
    cout << l << "\n";
}
