#include <bits/stdc++.h>

using namespace std;
int vodopad[2000][2000];
long int resenje[2000][2000],h,w;

void funkcija(long int k)
{
    long int pamtim=0,pamtim_i=-1;
    for(long int i=1;i<=w;i++)
    {
        if(vodopad[k+1][i]==1)
        {
            resenje[k+1][i]+=resenje[k][i];
            if(pamtim_i==-1) resenje[k+1][i]+=pamtim;
            else if(pamtim!=0&&(k+1)%2==0) {resenje[k+1][i]+=(pamtim/2+pamtim%2); resenje[k+1][pamtim_i]+=pamtim/2;}
            else if(pamtim!=0){resenje[k+1][pamtim_i]+=(pamtim/2+pamtim%2); resenje[k+1][i]+=pamtim/2;}
            pamtim=0;
            pamtim_i=i;

        }
        else
        {
            pamtim+=resenje[k][i];
            if(i==w) resenje[k+1][pamtim_i]+=pamtim;
        }
    }
}
int main()
{
    scanf("%ld%ld",&h,&w);
    for(long int i=1;i<=h;i++)
        for(long int j=1;j<=w;j++)
        {scanf("%d",&vodopad[i][j]); resenje[0][j]=1;}

    for(long int i=0;i<h;i++)
    {
        funkcija(i);
    }
    for(long int i=1;i<=w;i++)
        printf("%ld ",resenje[h][i]);
    return 0;
}