fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(" ").map(String::toInt)
    var aMatrix = Array(n) {Array(m) {0}}
    var bVector = Array(m) {0}

    // Read matrix elements.
    repeat(n) {
        val values = readLine()!!.split(" ").map(String::toInt).toTypedArray()
        aMatrix[it] = values
    }

    // Read vector elements.
    repeat(m) { bVector[it] = readLine()!!.toInt() }

    // Compute A[i][j] * B[j] for each i.
    aMatrix.forEach {
        val sum = it.zip(bVector) { a, b -> a * b } .sum()
        println("$sum")
    }
}

