let () =
  let n, m = Scanf.scanf "%d %d\n" (fun x y -> x, y) in
  let a = Array.make n (Array.make m 0) in
  let b = Array.make m 0 in
  for i = 0 to n - 1 do
    let s = read_line () |> Str.split (Str.regexp " ") |> List.map int_of_string |> Array.of_list in
    a.(i) <- s
  done;

  for i = 0 to m - 1 do
    b.(i) <- read_line () |> int_of_string
  done;

  let rec zip x y = match x, y with
    | [], _ | _, [] -> []
    | (c::xs), (d::ys) -> (c, d) :: zip xs ys in

  let bl = Array.to_list b in
  let al = Array.to_list (Array.map Array.to_list a) in
  let f x y = List.fold_left (fun x (y, z) -> x + y * z) 0 (zip x y) in
  let cl = List.map (f bl) al in
  List.iter (Printf.printf "%d\n") cl