#include <bits/stdc++.h>
using namespace std;
const int infi = 1e9 + 7;
const long long infl = (long long)1e18 + (long long)7;
pair<long long, long long> ar[200500];
long long cur_cap[200500];
vector<int> tmp[200500];
int check(int n, int k, long long mid) {
  for (int i = 0; i < (n); ++i) cur_cap[i] = 0;
  for (int i = 0; i < (k); ++i) tmp[i].clear();
  for (int i = 0; i < (n); ++i) {
    long double a = 1.0l * ar[i].first / ar[i].second;
    if (a > k) continue;
    int b = ceill(a + 1e-9);
    tmp[b].emplace_back(i);
  }
  int pos = 0;
  for (int qwe = 0; qwe < (k); ++qwe) {
    for (; pos < k && tmp[pos].empty(); ++pos)
      ;
    if (pos == k) return 1;
    if (pos < qwe) return 0;
    int i = tmp[pos].back();
    tmp[pos].pop_back();
    long double a = 1.0l * cur_cap[i] * mid + ar[i].first - qwe * ar[i].second;
    if (a < 0) return 0;
    cur_cap[i]++;
    a = 1.0l * cur_cap[i] * mid + ar[i].first;
    a /= ar[i].second;
    if (a > k) continue;
    int b = ceill(a + 1e-9);
    tmp[b].emplace_back(i);
  }
  for (int i = 0; i < (k); ++i)
    if (tmp[i].size()) return 0;
  return 1;
}
int32_t main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < (n); ++i) cin >> ar[i].first;
  for (int i = 0; i < (n); ++i) cin >> ar[i].second;
  long long l = 0, r = 1e15, ans = -1;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (check(n, k, mid)) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  cout << ans << '\n';
  return 0;
}
