#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long int k;
  cin >> n >> k;
  if (k > 1000000000000) {
    k = 1000000000000;
  }
  long long int a[n], f[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> f[i];
  }
  sort(a, a + n);
  sort(f, f + n);
  reverse(f, f + n);
  pair<long long int, long long int> p;
  priority_queue<pair<long long int, long long int> > v;
  for (int i = 0; i < n; i++) {
    p.first = a[i] * f[i];
    p.second = f[i];
    v.push(p);
  }
  long long int order = 0;
  while (k > 0) {
    if (k >= 400000) {
      order = k / 200000;
      p = v.top();
      v.pop();
      p.first = p.first - p.second * order;
      if (p.first < 0) {
        p.first = 0;
      }
      v.push(p);
      k = k - order;
    } else {
      p = v.top();
      v.pop();
      p.first = p.first - p.second;
      v.push(p);
      k--;
    }
  }
  p = v.top();
  if (p.first < 0) {
    p.first = 0;
  }
  cout << p.first << endl;
  return 0;
}
