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

typedef long long ll;
const ll MOD = 1e9+7;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;

    vector<vector<int> >a(n+2,vector<int>(m+2,-1));
    vector<vector<int> >l(n+2,vector<int>(m+2,0));
    vector<vector<int> >r(n+2,vector<int>(m+2,0));
    vector<vector<int> >ans(n+2,vector<int>(m+2,0));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>a[i][j];
        }
    }

    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(a[i][j]==0){
                if(a[i][j-1]==0)l[i][j]=l[i][j-1];
                else l[i][j]=j-1;/* left border is gonna be 0*/
            }
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=m;j>=1;j--){
            if(a[i][j]==0){
                if(a[i][j+1]==0)r[i][j]=r[i][j+1];
                else r[i][j]=j+1;/* right border is gonna be m+1*/
            }
        }
    }
    for(int j=1;j<=m;j++)ans[1][j]=1;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(a[i][j]==0){
                int fallLeft=l[i][j];
                int fallRight=r[i][j];
                if(fallLeft==0){
                    ans[i+1][fallRight]+=ans[i][j];
                }else if(fallRight==m+1){
                    ans[i+1][fallLeft]+=ans[i][j];
                }else{
                    int s1=ans[i][j]/2;
                    int s2=ans[i][j]/2;
                    if(ans[i][j]%2==1){
                        if(i%2==1)s1++;
                        else s2++;
                    }
                    ans[i+1][fallLeft]+=s1;
                    ans[i+1][fallRight]+=s2;
                }
                ans[i+1][j]=0;
            }else{
                ans[i+1][j]+=ans[i][j];
            }
        }
    }

    for(int j=1;j<=m;j++)cout<<ans[n+1][j]<<" ";
    return 0;
}