MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
N,K=gsmi
A=gsmi.sort
F=desc gsmi

putsend(0) if sum(A)<=K

# コストnumでできるか？
def can(num)
  train=0
  N.times do |i|
    train += A[i]-num/F[i] if A[i]*F[i]>num
  end
  train <= K
end

l=1
r=10**12
while l != r do
  cen= r-l>1 ? (l+r)/2 : l
  #puts cen
  if can(cen)
    r=cen
  else
    break if l==cen
    l=cen
  end
end

puts r