#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define srt(v) sort(v.begin(),v.end())
#define srtg(v,int) sort(v.begin(),v.end(),greater<int>())
#define lb(a,v) lower_bound(v.begin(),v.end(),a)
#define ub(a,v) upper_bound(v.begin(),v.end(),a)
#define fnd(a,v) find(v.begin(),v.end(),a)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef string str;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    vector<bool> pom(m,false);
    vector<vector<bool> > mat(n+1,pom);
    vector<int> pom2(m,0);
    vector<vector<int> > res(n+1,pom2);
    vector<vector<int> > res2(n+1,pom2);
    for(int i=1;i<=n;i++){
        for(int j=0;j<m;j++){
            int a;
            cin>>a;
            mat[i][j]=(a==1);
        }
    }
    for(int i=0;i<m;i++){res[0][i]=1; res2[0][i]=1;}
    for(int i=1;i<=n;i++){
        int prosli=-1;
        for(int j=0;j<m;j++) res[i][j]=res2[i-1][j];
        for(int j=0;j<m;j++){
   //         cout<<i<<" "<<j<<" "<<prosli<<" "<<(mat[i][j] ? 1:0)<<"\n";
            if(!mat[i][j]){
                if(j-prosli>1)
                res[i][j]+=(j>0 ? res[i][j-1]:0);
            }else{
                if(j-prosli>1){
                    res2[i][j]=res2[i-1][j];
                    if(prosli==-1){
                        res2[i][j]+=res[i][j-1];
                    }else{
                        res2[i][j]+=res[i][j-1]/2;
                        res2[i][prosli]+=res[i][j-1]/2;
                        if(i%2==0){
                            res2[i][j]+=res[i][j-1]%2;
                        }else{
                            res2[i][prosli]+=res[i][j-1]%2;
                        }
                    }
                }else{
                    res2[i][j]=res[i][j];
                }
                prosli=j;
            }
        }
        if(prosli!=m-1){
            res2[i][prosli]+=res[i][m-1];
        }
        for(int j=0;j<m;j++){
            if(!mat[i][j]) res2[i][j]=0;
        }
    }
 /*   cout<<"\n";
    for(int i=0;i<=n;i++){
        for(int j=0;j<m;j++){
            cout<<res2[i][j]<<" ";
        }
        cout<<"\n";
    }
    cout<<"\n";
    for(int i=0;i<=n;i++){
        for(int j=0;j<m;j++){
            cout<<res[i][j]<<" ";
        }
        cout<<"\n";
    }*/
    for(int i=0;i<m;i++){
        cout<<res2[n][i]<<" ";
    }
    return 0;
}