#include <bits/stdc++.h>
 
using namespace std;

vector<vector<int>> v,dp;
vector<int> pom;
int i,j,n,h,a,l,s;
 
int main()
{
    std::ios_base::sync_with_stdio(false);
    cin>>h>>n;
    for(i=0;i<n;i++) pom.push_back(0);
    v.push_back(pom);
    dp.push_back(pom);
    for(i=0;i<h;i++){
        v.push_back(pom);
        for(j=0;j<n;j++){
            cin>>a;
            a^=1;
            v[i+1][j]=a;
        }
    }
    for(i=0;i<n;i++) dp[0][i]=1;
    for(i=1;i<=h;i++){
        l=-1;
        s=0;
        dp.push_back(pom);
        for(j=0;j<n;j++){
            if(v[i][j]==0){
                dp[i][j]+=dp[i-1][j];
                if(j!=0 && v[i][j-1]==0) {l=j; continue;}
                if(l==-1) {dp[i][j]+=s; s=0; l=j; continue;}
                dp[i][j]+=s/2;
                dp[i][l]+=s/2;
                if(i%2) dp[i][l]+=s%2;
                else dp[i][j]+=s%2;
                l=j;
                s=0;
            }
            else{
                s+=dp[i-1][j];
            }
        }
        dp[i][l]+=s;
    }
    for(i=0;i<n;i++) cout<<dp[h][i]<<" ";
    return 0;
}