#include <bits/stdc++.h>
long long poww(long long x, long long y) {
  long long res = 1;
  x %= 1000000007;
  for (; y; y >>= 1) {
    if (y & 1) res = res * x % 1000000007;
    x = x * x % 1000000007;
  }
  return res;
}
inline int scan() {
  char c = getchar();
  int x = 0;
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return x;
}
inline long long scanll() {
  char c = getchar();
  long long x = 0;
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return x;
}
using namespace std;
long long a[200005];
int b[200005];
int lastupd[200005];
long long c[200005], n, k;
vector<int> v[200005];
bool fnc(long long x) {
  int toBeCharged;
  for (int i = 0; i <= k; ++i) v[i].clear();
  for (int i = 0; i < n; ++i) {
    c[i] = a[i];
    if (c[i] / b[i] <= k) v[c[i] / b[i]].push_back(i);
    lastupd[i] = 0;
  }
  for (int i = 0; i <= k; ++i)
    if (!v[i].empty()) {
      toBeCharged = i;
      break;
    }
  int id;
  for (long long i = 1; i < k; ++i) {
    if (toBeCharged >= k) return true;
    id = v[toBeCharged][v[toBeCharged].size() - 1];
    v[toBeCharged].pop_back();
    if (toBeCharged == i - 1 && !v[toBeCharged].empty()) return false;
    c[id] -= b[id] * (i - lastupd[id]) - x;
    lastupd[id] = i;
    if (c[id] < 0)
      return false;
    else {
      if (i + c[id] / b[id] < k) v[i + c[id] / b[id]].push_back(id);
    }
    while (toBeCharged <= 200002 && v[toBeCharged].empty()) toBeCharged++;
  }
  return true;
}
int main() {
  int q, i, j;
  long long rr = 0;
  n = scan();
  k = scan();
  for (i = 0; i < n; ++i) a[i] = scanll();
  for (i = 0; i < n; ++i) {
    b[i] = scanll();
    rr = max(rr, b[i] * k);
  }
  long long l = 0, r = rr, mid;
  mid = l + r >> 1;
  while (l < r) {
    mid = l + r >> 1;
    if (fnc(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (r == rr)
    cout << -1;
  else
    cout << r;
  return 0;
}
