#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll p = 1000000007;
struct comparator {
  bool operator()(const pair<ll, ll> &lhs, const pair<ll, ll> &rhs) {
    return -lhs.first < -rhs.first;
  }
};
auto comp = comparator();
bool check(vector<vector<ll>> vec, ll n, ll k, ll curr, const vector<ll> &ais,
           const vector<ll> &bis) {
  vector<ll> count(n, 0);
  ll ci = 0;
  for (int i = 0; i < k - 1; ++i) {
    while (ci < k - 1 && vec[ci].size() == 0) ci++;
    if (ci == k - 1) break;
    ll index = vec[ci].back();
    vec[ci].pop_back();
    count[index]++;
    ll value = count[index] * curr + ais[index];
    if (i > ci) {
      return false;
    }
    ll nval = value / bis[index];
    if (nval <= k - 1) {
      vec[nval].push_back(index);
    }
  }
  while (ci < k - 1 && vec[ci].size() == 0) ci++;
  return ci == k - 1;
}
int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> ais(n), bis(n);
  for (int i = 0; i < n; ++i) {
    cin >> ais[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> bis[i];
  }
  vector<vector<ll>> vec(k);
  ll high = 0;
  for (int i = 0; i < n; ++i) {
    ll cval = ais[i] / bis[i];
    high = max(high, (k - 1) * bis[i] - ais[i]);
    if (cval <= k - 1) {
      vec[cval].push_back(i);
    }
  }
  ll ci = 0;
  while (ci < k - 1 && vec[ci].size() == 0) ci++;
  if (ci == k - 1) {
    cout << 0 << endl;
    return 0;
  }
  ll low = 0;
  if (!check(vec, n, k, high, ais, bis)) {
    cout << -1 << endl;
    return 0;
  }
  while (high - low > 1) {
    ll mid = (low + high) / 2;
    if (check(vec, n, k, mid, ais, bis))
      high = mid;
    else
      low = mid;
  }
  cout << high << endl;
  return 0;
}
