import scala.io.StdIn.{readLine, readInt}

object Main extends App {

  val Array(n, m) = readLine().split(" ").map { _.toInt }

  val lines = Seq.fill(n)(readLine())
  val ys    = Seq.fill(m)(readInt())

  val xss = for {
    line <- lines
    xs    = line.split(" ").map { _.toInt }
  } yield xs.toSeq

  val result = xss.map { xs =>
    val zs = (xs zip ys).map { case (x, y) => x * y }
    zs.sum
  }

  result.foreach(println)
}

