        n=io.read("*n")
        k=io.read("*k")
         
        a={}
        f={}
         
        for i=1, n do
          table.insert(a, io.read("*n"))
        end
        for i=1, n do
          table.insert(f, io.read("*n"))
        end
            
            table.sort(a)
            for i=1, n do
              if a[i]<k then
                a[i]=0
                k=k-a[i]
              elseif (not(k==0)) and a[i]>=k then
                a[i]=a[i]-k
                k=0
                break
              end
            end
            
            function maxpos(t, len)
              p=1
              for i=1,len do
                if t[i]>t[p] then
                  p=i
                end
              end
            end
            function minpos(t, len)
              q=1
              for i=1,len do
                if t[i]<t[q] then
                  q=i
                end
              end
            end
            v={}
            for i=1,n do
              v[i]=math.min(unpack(a))*math.max(unpack(f))
              table.remove(a, minpos(a, n))
              n=n-1
            end
              
            print(math.max(unpack(v)))