n, m = gets.split.map(&:to_i)

dist = (1..n).map{ gets.to_i }
cost = (1..m).map{ gets.to_i }

table = (1..2).map{ [0] + [10**10] * n }
m.times {|day|
    (0..[day,n-1].min).each{|city|
        table[1][city+1] = [table[0][city+1], table[0][city] + dist[city] * cost[day]].min
    }
    table << table.shift
}
p table[0][-1]