#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const int N = 2e5 + 5;
int n, k;
long long a[N], b[N], c[N];
long long inline calc(int i, int t) {
  if (c[i] - b[i] * t < 0) return -1;
  long long x = (c[i] - b[i] * t) / b[i];
  return x + 1;
}
bool go(long long x) {
  priority_queue<pair<long long, int>, vector<pair<long long, int> >,
                 greater<pair<long long, int> > >
      pq;
  for (int i = 0; i < n; i++) c[i] = a[i];
  for (int i = 0; i < n; i++) pq.push(pair<long long, int>(calc(i, 0), i));
  for (int i = 0; i < k; i++) {
    int at = pq.top().second;
    pq.pop();
    if (c[at] - b[at] * i < 0) return false;
    c[at] += x;
    pq.push(pair<long long, int>(i + 1 + calc(at, i + 1), at));
    if (pq.top().first < i) return false;
  }
  return true;
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  long long bot = 0, top = 1e13 + 13;
  long long ans = -1;
  while (bot <= top) {
    long long mid = (bot + top) >> 1;
    if (go(mid)) {
      ans = mid;
      top = mid - 1;
    } else {
      bot = mid + 1;
    }
  }
  cout << ans << endl;
  return 0;
}
