#include <iostream>
#include <vector>
#define ll long long
using namespace std;

int main()
{
    ll h, n;
    cin>>h>>n;
    ll vodopad[h][n], protok[h][n]= {0};
    for(ll i=0; i<h; ++i)
    {
        for(ll j=0; j<n; ++j)
        {
            cin>>vodopad[i][j];
        }
    }

    for(ll i=0; i<n; ++i)
        protok[0][i]=1;

    for(ll i=0; i<h; ++i)
    {
        ll brojacStena=0, pocetak=0, kraj=n-1;
        for(ll j=0; j<n; ++j)
        {
            for(ll k=0; k<n; ++k)
            {
                if(vodopad[i][k]==0)
                    brojacStena++;
            }
            //Trenutno ispod stene
            if(i>0)
            {
                if(vodopad[i-1][j]==1)
                    protok[i][j]+=protok[i-1][j];
            }
            //Trenutno stena
            if(vodopad[i][j]==0)
            {
                ll trenProt=protok[i][j];
                //Leva ivica
                if(j==0)
                {
                    protok[i][j+1]+=trenProt;
                }
                //Desna ivica
                else if(j==n-1)
                {
                    protok[i][j-1]+=trenProt;
                }
                //Nije ivica
                else
                {
                    //protok neparan
                    if(trenProt%2==1)
                    {
                        //postaje paran, jedinica viska se dodaje levo desno zavisno od parnosti reda.
                        trenProt--;
                        if((i+1)%2==1)
                            protok[i][j-1]++;
                        else
                            protok[i][j+1]++;
                    }
                    //svakako polovine dodaj na levu i desnu stranu
                    trenProt/=2;
                    protok[i][j-1]+=trenProt;
                    protok[i][j+1]+=trenProt;
                }
                protok[i][j]=0;
            }
        }
    }

    for(ll i=0; i<n; ++i)
    {
        cout<<protok[h-1][i]<<" ";
    }
    cout<<"\n";
    return 0;
}