main(require("fs").readFileSync("/dev/stdin", "utf8").replace(/\r?\n$/, "").split(/\r?\n/));

function main(lines){
	var a, i;
	
	a = lines.shift().split(" ").map(Number);
	var n = a[0], m = a[1];

	var aRows = [];
	for(i=0;i<n;i++) aRows.push(lines.shift().split(" ").map(Number));

	var bs = [];
	for(i=0;i<m;i++) bs.push(lines.shift().split(" ").map(Number));

	aRows.forEach(function(r){
		console.log(r.map(function(a,i){return a*bs[i];}).reduce(function(a,b){return a+b;}));
	});
}