#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  long long minimize(vector<long long>& vols, vector<long long>& costs, int k) {
    const long long INF = LLONG_MAX / 200000;
    long long l = 0;
    long long r = INF;
    int n = vols.size();
    vector<int> charges(k + 1, 0);
    auto isOK = [&](long long x) -> bool {
      long long reqs = 0;
      for (int i = 0; i < n; ++i) {
        if (vols[i] < costs[i] * (k - 1)) {
          if (x <= 0) {
            return false;
          }
          reqs += (costs[i] * (k - 1) - vols[i] + x - 1) / x;
        }
      }
      if (reqs > k) {
        return false;
      }
      fill(charges.begin(), charges.end(), 0);
      for (int i = 0; i < n; ++i) {
        long long req = costs[i] * (k - 1) - vols[i];
        long long d = vols[i] / costs[i] + 1;
        long long rem = vols[i] - costs[i] * d;
        while (req > 0) {
          ++charges[d];
          rem += x;
          if (rem >= 0) {
            long long dd = rem / costs[i] + 1;
            rem -= dd * costs[i];
            d += dd;
          }
          req -= x;
        }
      }
      int sum = 0;
      for (int i = 1; i < k; ++i) {
        sum += charges[i];
        if (sum > i) {
          return false;
        }
      }
      return sum <= k;
    };
    while (l < r) {
      long long m = l + (r - l) / 2;
      if (isOK(m)) {
        r = m;
      } else {
        l = m + 1;
      }
    }
    return l >= INF ? -1 : l;
  }
};
int main(int argc, char** argv) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  Solution sol;
  int n, k;
  cin >> n >> k;
  vector<long long> vols(n);
  for (int i = 0; i < n; ++i) {
    cin >> vols[i];
  }
  vector<long long> costs(n);
  for (int i = 0; i < n; ++i) {
    cin >> costs[i];
  }
  cout << sol.minimize(vols, costs, k) << "\n";
  return 0;
}
