#include <bits/stdc++.h>
using namespace std;
struct P {
  long long x, y;
  bool operator<(const P &a) const { return x * a.y > a.x * y; }
};
vector<P> v[200011], v1[200011];
int i, n, d, m, k, a, b, c, e;
int o[511][555];
int l[205111];
int j[1];
int dx[10] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[10] = {1, 0, -1, 0, 1, -1, 1, -1},
    dz[10] = {0, 0, 0, 0, 1, -1};
long long mod = 1000000007, mod2 = 1000000009, mod3 = 2017;
long long x, z, y;
double pi = 3.14159265;
P u[211111];
stack<int> s;
priority_queue<P> q;
char r[551];
bool as(int a, int b) { return a > b; }
int main() {
  scanf("%d %d", &a, &b);
  for (int t = 1; t <= a; t++) scanf("%lld", &u[t].x);
  for (int t = 1; t <= a; t++) scanf("%lld", &u[t].y);
  for (int t = 1; t <= a; t++)
    if (u[t].x / u[t].y <= b) v1[u[t].x / u[t].y].push_back({u[t].x, u[t].y});
  x = 2100000000000, y = 0;
  for (; y < x;) {
    long long h = (x + y) / 2;
    n = 1, m = 0;
    for (int t = 0; t <= 200000; t++)
      for (int h = 0; h < v1[t].size(); h++) v[t].push_back(v1[t][h]);
    for (; n <= b; n++) {
      for (; v[m].size() == 0 && m < b; m++)
        ;
      if (m == b) {
        x = h;
        break;
      }
      if ((m < n - 1) || (n < b && (v[m][v[m].size() - 1].x + h) / n <
                                       v[m][v[m].size() - 1].y)) {
        y = h + 1;
        goto qwe;
      } else {
        if ((v[m][v[m].size() - 1].x + h) / v[m][v[m].size() - 1].y < b) {
          P p = {v[m][v[m].size() - 1].x + h, v[m][v[m].size() - 1].y};
          v[m].pop_back();
          v[p.x / p.y].push_back({p.x, p.y});
        } else {
          v[m].pop_back();
        }
      }
    }
    x = h;
  qwe:;
    for (int t = 0; t <= 200000; t++)
      for (; v[t].size(); v[t].pop_back())
        ;
  }
  if (x == 2100000000000)
    puts("-1");
  else
    printf("%lld", x);
}
