#include <bits/stdc++.h>
using namespace std;
namespace FGF {
const int N = 2e5 + 5;
int n, m;
long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') w = -w;
    ch = getchar();
  }
  while (isdigit(ch)) {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * w;
}
struct Node {
  long long a, b, tim;
  Node(){};
  Node(long long _a, long long _b, long long _t) : a(_a), b(_b), tim(_t){};
} c[N];
bool operator<(Node x, Node y) { return x.tim > y.tim; }
bool check(long long x) {
  priority_queue<Node> q;
  while (q.size()) q.pop();
  for (int i = 1; i <= n; i++)
    if (c[i].tim < m) q.push(c[i]);
  if (q.empty()) return 1;
  for (int i = 0; i < m; i++) {
    Node u = q.top();
    q.pop();
    if (u.tim < i) return 0;
    u.a += x;
    u.tim = u.a / u.b;
    if (u.tim < m) q.push(u);
    if (q.empty()) return 1;
  }
  return 1;
}
void work() {
  n = read(), m = read();
  for (int i = 1; i <= n; i++) c[i].a = read();
  for (int i = 1; i <= n; i++) c[i].b = read(), c[i].tim = c[i].a / c[i].b;
  long long l = 0, r = 5e12, ans = -1;
  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);
}
}  // namespace FGF
int main() {
  FGF::work();
  return 0;
}
