process.stdin.resume();
process.stdin.setEncoding("utf8");

const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

const lines = [];

reader.on("line", (line) => {
  lines.push(line);
});

reader.on("close", () => {
  const [n, m] = p(lines[0]);
  const op = [];
  for (let i = 0; i < m; i++) {
    op[i] = Number(lines[i + n + 1]);
  }
  for (let i = 1; i <= n; i++) {
    const row = p(lines[i]);
    let sum = 0;
    for (let j = 0; j < m; j++) {
      sum += row[j] * op[j];
    }
    console.log(sum);
  }
});

const p = (s) => s.split(" ").map(Number);

