#include <stdio.h>
#include <stdlib.h>
#include <utility>
typedef unsigned long lu;

void split(lu tacka1,lu tacka2,lu *niz,lu sum,bool neparan)
{
    niz[tacka1]+=sum/2;
    niz[tacka2]+=sum/2;
    if(sum%2)
    {
        if(neparan)
            niz[tacka1]++;
        else
            niz[tacka2]++;
    }


}
int main()
{

    lu n,h;
    scanf("%lu%lu",&h,&n);
    bool **vodopad=(bool**)malloc(h*sizeof(bool*));
    lu *protok=(lu*)calloc(n,sizeof(lu));
    for(lu i=0;i<h;i++)
    {
        vodopad[i]=(bool*)calloc(n,sizeof(bool));

        for(lu j=0;j<n;j++)
        {
            if(i==0) protok[j]=1;
            scanf("%d",&vodopad[i][j]);
        }

    }
    long long levak,desnjak;
    bool imaPotrebe;
    lu sum=0;
    for(lu i=0;i<h;i++)
    {
        levak=-1;
        desnjak=-1;
        imaPotrebe=false;
        for(lu j=0;j<n;j++)
        {
            if(!vodopad[i][j])
            {
                imaPotrebe=true;
                sum+=protok[j];
                protok[j]=0;
            }
            if(vodopad[i][j]&&imaPotrebe)
            {
                if(levak>=0)
                {
                    desnjak=j;
                    split(levak,desnjak,protok,sum,(i+1)%2);//razdvoji na levu i desnu stranu
                    sum=0;
                    imaPotrebe=false;
                }
                else
                {
                    protok[j]+=sum;
                    sum=0;
                    imaPotrebe=false;
                }

            }
            else if(imaPotrebe&&levak>=0&&j==n-1)
            {
                protok[levak]+=sum;
                sum=0;
                imaPotrebe=false;
            }
            if(vodopad[i][j]&&!imaPotrebe)
                levak=j;
        }
        if(imaPotrebe&&levak>=0)
        {
            protok[levak]+=sum;
            sum=0;
            imaPotrebe=false;
        }
    }
    for(lu i=0;i<n;i++)
        printf("%lu ",protok[i]);
    return 0;
}