#include <bits/stdc++.h>
void swap(int array[], int lo, int hi) {
  int temp = array[lo];
  array[lo] = array[hi];
  array[hi] = temp;
}
void shuffle(int array[], int size) {
  for (int i = 0; i < size; i++) {
    int j = rand() % size;
    swap(array, i, j);
  }
}
int partition(int array[], int low, int hig) {
  int i = low;
  int j = hig + 1;
  while (1) {
    while (array[++i] < array[low]) {
      if (i == hig) break;
    }
    while (array[low] < array[--j]) {
      if (j == low) break;
    }
    if (i >= j) break;
    swap(array, i, j);
  }
  swap(array, low, j);
  return j;
}
void sort(int array[], int lo, int hi) {
  if (hi <= lo) return;
  int j = partition(array, lo, hi);
  sort(array, lo, j - 1);
  sort(array, j + 1, hi);
}
void quicksort(int array[], int size) {
  shuffle(array, size);
  sort(array, 0, size - 1);
}
int insertionsort(int a[], int mini) {
  if (mini == 0) return 0;
  int i = mini;
  while (a[i - 1] > a[mini]) {
    i--;
    if (i == 0) break;
  }
  swap(a, i, mini);
  return i;
}
int findmin(long int af[], int n) {
  int mini = 0;
  for (int i = 0; i < n; i++) {
    if (af[i] < af[mini]) mini = i;
  }
  return mini;
}
int main() {
  int n;
  long int k;
  scanf("%d%ld\n", &n, &k);
  int a[n + 1];
  int f[n + 1];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  scanf("\n");
  for (int i = 0; i < n; i++) {
    scanf("%d", &f[i]);
    f[i] *= -1;
  }
  quicksort(a, n);
  quicksort(f, n);
  long int af[n + 1];
  for (int i = 0; i < n; i++) {
    af[i] = a[i] * f[i];
  }
  for (long int j = 0; j < k; j++) {
    int mini;
    mini = findmin(af, n);
    if (a[mini] > 0) a[mini]--;
    int k = insertionsort(a, mini);
    for (int i = k; i <= mini; i++) {
      af[i] = a[i] * f[i];
    }
  }
  int s;
  s = findmin(af, n);
  printf("%ld\n", -af[s]);
  return 0;
}
