#include <bits/stdc++.h>

using namespace std;
int vodopad[2000000];
long int resenje[2000000],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)*w+i]==1)
        {
            resenje[(k+1)*w+i]+=resenje[k*w+i];
            if(pamtim_i==-1) resenje[(k+1)*w+i]+=pamtim;
            else if(pamtim!=0&&(k+1)%2==0) {resenje[(k+1)*w+i]+=(pamtim/2+pamtim%2); resenje[(k+1)*w+pamtim_i]+=pamtim/2;}
            else if(pamtim!=0){resenje[(k+1)*w+pamtim_i]+=(pamtim/2+pamtim%2); resenje[(k+1)*w+i]+=pamtim/2;}
            pamtim=0;
            pamtim_i=i;

        }
        else
        {
            pamtim+=resenje[k*w+i];
            if(i==w) resenje[(k+1)*w+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*w+j]); resenje[j]=1;}

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