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

int h,n;
int v[1000005];
int t[1000005];

int main()
{
    scanf("%d%d",&h,&n);
    for(int i=1; i<=n; i++)
        t[i]=1;
    v[n+1]=-1;
    for(int r=1; r<=h; r++)
    {
        for(int i=1; i<=n; i++)
            scanf("%d",&v[i]);
        int wl,wr;
        for(int i=1; i<=n; i++)
        {
            if(v[i]==1)
                continue;
            if(v[i]==0)
            {
                wl=i;
                wr=i;
                while(v[wr]==0)
                    wr++;
                wr--;

                int sum=0;
                for(int j=wl; j<=wr; j++)
                    sum+=t[j];

                if(wl==1)
                {
                    t[wr+1]+=sum;
                }
                else if(wr==n)
                {
                    t[wl-1]+=sum;
                }
                else if(r%2==1)
                {
                    t[wl-1]+=sum/2+sum%2;
                    t[wr+1]+=sum/2;
                }
                else if(r%2==0)
                {
                    t[wl-1]+=sum/2;
                    t[wr+1]+=sum/2+sum%2;
                }

                for(int j=wl; j<=wr; j++)
                    t[j]=0;
            }
        }
    }
    for(int i=1; i<=n; i++)
        printf("%d ",t[i]);
    return 0;
}