local w, h = io.read("*n", "*n")
local lim = (w + 1) * (h + 1) - 1
local cost = {}
local idxs = {}
for i = 1, w + h do
  cost[i] = io.read("*n")
  idxs[i] = i
end
table.sort(idxs, function(a, b) return cost[a] > cost[b] end)

local wuse, huse = 0, 0
local cnt = 0
local ret = 0LL
while cnt < lim do
  local idx = idxs[#idxs]
  table.remove(idxs)
  local u = 0
  if idx <= w then
    wuse = wuse + 1
    u = h + 1 - huse
  else
    huse = huse + 1
    u = w + 1 - wuse
  end
  cnt = cnt + u
  ret = ret + cost[idx] * u
end
local str = tostring(ret):gsub("LL", "")
print(str)
