#include <bits/stdc++.h>
using namespace std;
void read(int &val) {
  int x = 0;
  int bz = 1;
  char c;
  for (c = getchar(); (c < '0' || c > '9') && c != '-'; c = getchar())
    ;
  if (c == '-') {
    bz = -1;
    c = getchar();
  }
  for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - 48;
  val = x * bz;
}
const int INF = 0x3f3f3f3f;
const int maxn = 1e6 + 100;
const int mod = 998244353;
long long a[maxn], b[maxn];
int n, k;
struct node {
  long long sum, b, tim;
  bool operator<(const node bb) const { return tim > bb.tim; }
};
bool check(long long mid) {
  priority_queue<node> q;
  for (int i = 1; i <= n; i++) {
    long long tim = a[i] / b[i];
    q.push(node{a[i], b[i], tim});
  }
  for (int i = 0; i <= k - 1; i++) {
    node top = q.top();
    q.pop();
    if (top.tim < i) return false;
    if (top.tim >= k) return true;
    top.sum += mid;
    long long tim = top.sum / top.b;
    if (tim < i) return false;
    q.push(node{top.sum, top.b, tim});
  }
  return true;
}
int main() {
  read(n);
  read(k);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%lld", &b[i]);
  long long ans = -1, l = 0, r = 1e13;
  while (l <= r) {
    long long mid = l + r >> 1;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  printf("%lld\n", ans);
  return 0;
}
