#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
static int N, K;
static long long ini[MAXN], sub[MAXN];
struct State {
  long long t, d, s;
  friend bool operator<(const State &x, const State &y) { return x.t > y.t; }
};
inline State get_state(long long t, long long cur, long long d) {
  long long dt = cur / d + 1, down = dt * d - cur;
  return (State){t + dt, down, d};
}
inline bool check(long long x) {
  priority_queue<State> Q;
  for (int i = 0; i < N; i++) Q.push(get_state(1, ini[i], sub[i]));
  long long top = 1;
  while (!Q.empty()) {
    State st = Q.top();
    Q.pop();
    if (st.t > K) break;
    if (x == 0) return false;
    long long req = (st.d + x - 1) / x;
    if ((top += req) > st.t) return false;
    Q.push(get_state(st.t, req * x - st.d, st.s));
  }
  return true;
}
int main() {
  scanf("%d%d", &N, &K);
  for (int i = 0; i < N; i++) scanf("%lld", &ini[i]);
  for (int i = 0; i < N; i++) scanf("%lld", &sub[i]);
  check(1);
  long long l = 0, r = 2e12, mid, ans = -1;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (check(mid))
      r = (ans = mid) - 1;
    else
      l = mid + 1;
  }
  printf("%lld\n", ans);
  return 0;
}
