#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct Com {
  ll a, b;
  Com(ll a = 0, ll b = 0) : a(a), b(b) {}
  ll getT() { return a / b; }
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  const ll inf = (ll)1e13 + 1e9;
  int n, k;
  cin >> n >> k;
  vector<Com> c(n);
  for (int i = 0; i < n; ++i) cin >> c[i].a;
  for (int i = 0; i < n; ++i) cin >> c[i].b;
  ll l = -1, r = inf;
  while (r - l > 1) {
    ll mid = l + r >> 1;
    auto possible = [&](ll mid) {
      vector<vector<Com>> ids(k);
      int charge = 0;
      for (int i = 0; i < n; ++i) {
        ll x = c[i].getT();
        if (x < k) ids[x].push_back(c[i]);
      }
      for (int i = 0; i < k - 1; ++i) {
        ++charge;
        for (int j = 0; j < ids[i].size(); ++j) {
          ll cx = ids[i][j].a % ids[i][j].b;
          if (mid == 0) return false;
          ll nch = (ids[i][j].b - cx + mid - 1) / mid;
          if (charge < nch) return false;
          charge -= nch;
          ids[i][j].a += mid * nch;
          ll x = ids[i][j].getT();
          if (x < k) ids[x].push_back(ids[i][j]);
        }
        ids[i].clear();
      }
      return true;
    };
    if (possible(mid))
      r = mid;
    else
      l = mid;
  }
  if (r == inf)
    cout << -1 << "\n";
  else
    cout << r << "\n";
  return 0;
}
