#require 'pp'
require 'set'

n, k = gets.chomp!.split(" ").map(&:to_i)
a_n = gets.chomp!.split(" ").map(&:to_i)
f_n = gets.chomp!.split(" ").map(&:to_i)

class Elem
    attr_accessor :key, :value

    def initialize(key, value)
        @key = key
        @value = value
    end

    def <=>(other)
        other.key <=> @key
    end
end

a_n2 = a_n.sort
f_n2 = f_n.sort.reverse!

sum = []
set = SortedSet.new
n.times do |i|
    sum[i] = a_n2[i] * f_n2[i]
    set << Elem.new(sum[i], [a_n2[i], f_n2[i]])
end

k.times do |i|
    x = set.first
    set.delete(x)
    if x.value[0] > 0
        x.value[0] = x.value[0] - 1
        x.key = x.value[0] * x.value[1]
        set << x
    end
end

ans = set.first
puts ans.key
