#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
const int INF = 1e9 + 7;
long long b[N], mt[N], a[N];
int n, k;
bool check(long long chr, priority_queue<pair<long long, long long> > pq,
           vector<long long> c) {
  int t = 0;
  while (t != k - 1) {
    long long v = pq.top().second, r = -pq.top().first;
    pq.pop();
    if (r < t) return false;
    c[v]++;
    pq.push(make_pair(-((a[v] + c[v] * chr) / b[v]), v));
    t++;
  }
  long long r = -pq.top().first;
  if (r < t) return false;
  return true;
}
int main() {
  priority_queue<pair<long long, long long> > pq;
  vector<long long> c;
  c.resize(N);
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &b[i]);
    pq.push(make_pair(-(a[i] / b[i]), i));
  }
  long long l = 0, r = 1e13;
  while (r - l > 1) {
    long long mid = (l + r) / 2;
    if (check(mid, pq, c))
      r = mid;
    else
      l = mid;
  }
  if (r == 1e13)
    puts("-1");
  else if (check(l, pq, c))
    printf("%lld", l);
  else
    printf("%lld", r);
}
