#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
using namespace std;
using ll = long long;
template <class T> using rev_priority_queue = priority_queue<T, vector<T>, greater<T> >;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))

template<class T> class Matrix {
private:
    
    int h,w;
    vector< vector<T> > mat;
    
public:
    
    Matrix(int n, int m): mat(n,vector<T>(m,0)) { h=n; w=m; }
    Matrix(vector<vector<T> > A): mat(A.size(),vector<T>(A[0].size(),0)){
        for(int i=0;i<A.size();i++)for(int j=0;j<A[0].size();j++)mat[i][j]=A[i][j];
        h=(int)A.size(); w=(int)A[0].size();
    }
    Matrix(vector<T> A): mat(A.size(),vector<T>(1,0)){
        for(int i=0;i<A.size();i++)mat[i][0]=A[i];
        h=(int)A.size(); w=1;
    }
    
    int height() { return h; }
    int width() { return w; }
    
    bool set_matrix_unit(){
        if(h!=w)return false;
        for(int i=0;i<h;i++)mat[i][i]=1;
        return true;
    }
    void set_matrix_zero(){
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++)mat[i][j]=0;
        }
    }
    
    void setval(int i, int j, T val){ this->mat[i][j]=val; }
    T getval(int i, int j){ return this->mat[i][j]; }
    
    //A=B
    Matrix & operator = (const Matrix &A){
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                this->mat[i][j]=A.mat[i][j];
            }
        }
        return *this;
    }
    
    //==
    bool operator == (const Matrix &A) const{
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(this->mat[i][j]!=A.mat[i][j])return false;
            }
        }
        return true;
    }
    
    //!=
    bool operator != (const Matrix &A) const{
        return !((*this)==A);
    }
    
    //=A+B
    Matrix operator + (const Matrix &A) const{
        Matrix<T> B(this->h,this->w);
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                B.mat[i][j]=this->mat[i][j]+A.mat[i][j];
            }
        }
        return B;
    }
    
    //=A-B
    Matrix operator - (const Matrix &A) const{
        Matrix<T> B(this->h,this->w);
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                B.mat[i][j]=this->mat[i][j]-A.mat[i][j];
            }
        }
        return B;
    }
    
    //=A*B ???????????????????????????
    Matrix operator * (const Matrix &A) const{
        Matrix<T> B(this->h,this->w);
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                for(int k=0;k<h;k++){
                    B.mat[i][j]+=this->mat[i][k]*A.mat[k][j];
                }
            }
        }
        return B;
    }
    
    Matrix operator % (const long long m) const{
        Matrix<T> B(this->h,this->w);
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                B.mat[i][j]=(this->mat[i][j]%m);
            }
        }
        return B;
    }
    
    //+=,-=,*=
    
    void pow_mod(long long n, long long m){
        Matrix<T> A(this->h,this->w); A.set_matrix_unit();
        Matrix<T> B(this->h,this->w); B=*this;
        for(;n>0;n>>=1){
            if(n&1)A=((A%m)*(B%m))%m;
            B=((B%m)*(B%m))%m;
        }
        *this=A;
    }
    
    //transpose
    //Matrix *transpose(Matrix &A){
    //    return A;
    //}
  
    //reverse
    
    //Matrix operator ? () const{
    //  return Matrix(1,1);
    //}
    
    void print_matrix(){
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){ std::cout<<mat[i][j]<<" "; }
            std::cout<<std::endl;
        }
    }
    
};


int main(){
    
    int h,w; cin>>h>>w;
    Matrix<int> A(max(h,w),max(h,w)),B(max(h,w),max(h,w));
    REP(i,h)REP(j,w){
        int t; cin>>t;
        A.setval(i,j,t);
    }
    REP(i,w){
        int t; cin>>t;
        B.setval(i,0,t);
    }
    
    A=A*B;
    
    REP(i,h){
        cout<<A.getval(i,0)<<endl;
    }
   
    return 0;
}

Measured memory_bytes: 3152