object Main {
  def main(args: Array[String]): Unit = {
    val scanner = new java.util.Scanner(System.in)

    val n, m = scanner.nextInt
    val a = Array.fill(n)(new Array[Int](m))
    val b = new Array[Int](m)

    for(i <- 0 until n) {
      for(j <- 0 until m) {
        a(i)(j) = scanner.nextInt
      }
    }
    for(i <- 0 until m) {
      b(i) = scanner.nextInt
    }

    for(i <- 0 until n) {
      println((a(i) zip b).foldLeft(0){ case (s, t) => s + t._1 * t._2 })
    }
  }
}
