#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
namespace fastIO {
bool IOerror = 0;
inline char nc() {
  static char buf[100000], *p1 = buf + 100000, *pend = buf + 100000;
  if (p1 == pend) {
    p1 = buf;
    pend = buf + fread(buf, 1, 100000, stdin);
    if (pend == p1) {
      IOerror = 1;
      return -1;
    }
  }
  return *p1++;
}
inline bool blank(char ch) {
  return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
inline void read(int& x) {
  char ch;
  while (blank(ch = nc()))
    ;
  if (IOerror) return;
  for (x = ch - '0'; (ch = nc()) >= '0' && ch <= '9'; x = x * 10 + ch - '0')
    ;
}
inline void readll(long long& x) {
  char ch;
  while (blank(ch = nc()))
    ;
  if (IOerror) return;
  for (x = ch - '0'; (ch = nc()) >= '0' && ch <= '9'; x = x * 10 + ch - '0')
    ;
}
};  // namespace fastIO
using namespace fastIO;
const int MAX = 2e5 + 50;
struct Node {
  long long a, b, c;
  Node(long long _a, long long _b, long long _c) : a(_a), b(_b), c(_c) {}
  bool operator<(const Node& o) const {
    return (c == o.c) ? ((a == o.a) ? (b < o.b) : (a > o.a)) : (c > o.c);
  }
};
long long a[MAX], b[MAX];
int n, k;
priority_queue<Node> q;
bool check(long long x) {
  while (q.size()) q.pop();
  for (int i = 0; i < n; i++)
    if (a[i] / b[i] < 1LL * k) q.push(Node(a[i], b[i], a[i] / b[i]));
  for (int i = 0; i < k; i++) {
    if (q.empty()) return true;
    Node now = q.top();
    q.pop();
    if (now.c < i) return false;
    if ((now.a + x) / now.b < 1LL * k)
      q.push(Node(now.a + x, now.b, (now.a + x) / now.b));
  }
  return true;
}
int main() {
  read(n);
  read(k);
  for (int i = 0; i < n; i++) readll(a[i]);
  for (int i = 0; i < n; i++) readll(b[i]);
  long long l = 0, r = 2e12, res = -1;
  while (l <= r) {
    long long mid = (l + r) >> 1LL;
    if (check(mid))
      res = mid, r = mid - 1LL;
    else
      l = mid + 1LL;
  }
  printf("%lld\n", res);
  return 0;
}
