#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(void)
{
    ll n,m;
    cin>>n>>m;
    //bool a[n+1][m+1]; ///niz indeksiran od 1!!!!!!!!!!!!!!!!!!
    int rad[n+2][m+2]; ///niz indeksiran od 1!!!!!!!!!!!!!!!!!!
    for(ll i=1; i<=n; i++)
    {
        for(ll j=1; j<=m; j++)
        {
            bool x;
            cin>>x;
            rad[i][j]=(x==1)?0:-1;
        }
    }
    for(ll i=1; i<=m; i++)
        rad[0][i]=1;
    /////////////////////////////////
    for(ll i=0; i<=n; i++)
    {
        for(ll j=1; j<=m; j++)
        {
            if(rad[i][j]!=-1) ///ako ima zid, onda je polje nebitno i njega ne gledamo
            {
                if(rad[i+1][j]!=-1)
                    rad[i+1][j]+=rad[i][j]; ///sada stavljamo pocetnu vrednost koju uvek dobijamo
                else
                {
                    ll sum=0;
                    ll flag=j;
                    while(rad[i+1][flag]==-1)
                        sum+=max(0,rad[i][flag]),flag+=1;
                    flag-=1; ///sada smo na poslednjem indeksu gde ima zid
                    //cout<<"suma je: "<<sum<<endl;
                    if(j==1) ///znaci da moram da ga bacim na desno
                    {
                        rad[i+1][flag+1]+=sum;
                        //cout<<"111 "<<sum<<' '<<i+1<<' '<<flag+1<<endl;

                        j=flag;
                    }
                    else if(flag==m)
                    {
                        rad[i+1][j-1]+=sum;
                        //cout<<"222"<<sum<<' '<<i+1<<' '<<j-1<<endl;
                        j=flag;
                    }
                    else///znaci da je negde da sredini i smemo da bacimo i levo i desno
                    {
                        if(sum%2==0)
                        {
                            rad[i+1][j-1]+=sum/2;
                            rad[i+1][flag+1]+=sum/2;
                            j=flag;

                            //cout<<"333 "<<sum<<endl;
                        }
                        else
                        {
                            if((i+1)%2==0) ///jedan na desno
                            {
                                rad[i+1][flag+1]+=1;
                                sum--;
                                rad[i+1][j-1]+=sum/2;
                                rad[i+1][flag+1]+=sum/2;
                                j=flag;

                                //cout<<"444 "<<sum<<endl;
                            }
                            else
                            {
                                rad[i+1][j-1]++;
                                sum--;
                                rad[i+1][j-1]+=sum/2;
                                rad[i+1][flag+1]+=sum/2;
                                j=flag;

                                //cout<<"555 "<<sum<<endl;
                            }
                        }
                    }
                }
                //if(rad[i+1][j]!=-1)
                 //   rad[i+1][j]+=rad[i][j];
            }
            //j++;
        }
    }
    /*
    cout<<endl<<endl;
    for(ll i=0;i<=n;i++)
    {
        for(ll j=1;j<=m;j++)
            if(rad[i][j]==-1) cout<<"0 ";
            else
                cout<<rad[i][j]<<' ';
        cout<<endl;
    }
    */
    for(ll i=1;i<=m;i++)
        if(rad[n][i]==-1) cout<<"0 ";
            else
                cout<<rad[n][i]<<' ';
}