import scala.io.StdIn

/**
  * AOJ
  */
object Main {

  def main(args: Array[String]): Unit = {

    val in = StdIn.readLine().split(" ").map(_.toInt)
    val n = in(0)
    val m = in(1)

    val A = Array.ofDim[Int](n,m)
    val b = new Array[Int](m)

    for(i <- 0 to n - 1){ A(i) = StdIn.readLine().split(" ").map(_.toInt) }
    for(i <- 0 to m - 1){ b(i) = StdIn.readInt() }

    for(i <- 0 to n - 1){
      println((A(i),b).zipped.map(_ * _).sum)
    }
  }
}