#include <bits/stdc++.h>
using namespace std;
long long n = 0, k = 0;
vector<long long> sp(0);
vector<vector<long long>> qe(0);
vector<long long> pw(0);
int fnd(long long bt, vector<vector<long long>> q, vector<long long> spp) {
  long long mv = 0;
  for (int i = 0; i < k - 1; i++) {
    mv++;
    for (int j = 0; j < q[i].size(); j++) {
      long long ind = q[i][j];
      while (spp[ind] < pw[ind]) {
        mv--;
        if (mv < 0) return 0;
        spp[ind] += bt;
      }
      if (mv < 0) return 0;
      if ((i + (spp[ind] / pw[ind])) < k) {
        q[(long long)i + (spp[ind] / pw[ind])].push_back(ind);
        spp[ind] %= pw[ind];
      }
    }
  }
  return 1;
}
int main() {
  cin >> n >> k;
  long long l = 0, r = 1000000000000000000;
  sp.resize(n);
  pw.resize(n);
  qe.resize(k + 1);
  for (int i = 0; i < n; i++) {
    cin >> sp[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> pw[i];
  }
  for (int i = 0; i < n; i++) {
    if ((sp[i] / pw[i]) >= k) continue;
    qe[sp[i] / pw[i]].push_back(i);
    sp[i] %= pw[i];
  }
  while (l < r - 1) {
    long long mid = (l + r) / 2;
    if (fnd(mid, qe, sp))
      r = mid;
    else
      l = mid;
  }
  if (!fnd(r, qe, sp))
    cout << -1;
  else
    cout << (fnd(l, qe, sp) ? l : r);
  return 0;
}
