object Main extends App {
  import scala.io.StdIn._


  val Array(h, w) = readLine.trim.split(' ').map(_.toInt)
  val a = readLine.trim.split(' ').map(_.toInt).sorted
  val b = readLine.trim.split(' ').map(_.toInt).sorted

  println(
    b.map(n ⇒ (h - upperBound(a, n)) * n).sum + a.map(n ⇒ (w - lowerBound(b, n)) * n).sum
  )

  def upperBound(array: Array[Int], target: Int): Long = {
    var left = 0
    var right = array.length
    while(left < right){
      val mid = (left + right) / 2
      if (array(mid) <= target){
        left = mid + 1
      }else {
        right = mid
      }
    }
    right
  }
  def lowerBound(array: Array[Int], target: Int): Long = {
    var left = 0
    var right = array.length
    while(left < right){
      val mid = (left + right) / 2
      if (array(mid) < target){
        left = mid + 1
      }else {
        right = mid
      }
    }
    right
  }
  implicit class Scope[T](val value: T) extends AnyVal {
    @inline
    def let[A](func: T ⇒ A): A = func(value)
  }
}
