import java.util.*

/**
 * 行列.
 */
data class Matrix(val elements: List<List<Int>>) {
    /**
     * 行数.
     */
    val row = this.elements.size
    /**
     * 列数.
     */
    val col = if (this.row > 0) this.elements[0].size else 0

    /**
     * 指定された行列の要素を返します.
     * @param row 行
     * @param col 列
     * @return 要素
     */
    fun get(row: Int, col: Int) = this.elements.get(row).get(col)

    /**
     * 行列の掛け算の結果を返します.
     * @param other 乗数の行列
     */
    fun times(other: Matrix): Matrix = Matrix(
        elements.map { e ->
            (0..other.col - 1).map { col ->
                e.foldIndexed(0, {row, acc, a -> acc + a * other.get(row, col)})
            }
        }
    )

    override fun toString(): String =
        this.elements.map { it.joinToString(" ") }.joinToString("\n")
}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val m = scanner.nextInt()
    val A = Matrix((1..n).map {
        (1..m).map { scanner.nextInt() }
    })
    val b = Matrix((1..m).map {
        listOf(scanner.nextInt())
    })
    println(A.times(b))
}
