#include <bits/stdc++.h>

using namespace std;

int n, m;
// bool matra[n][m];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin>>n>>m;
    //cout<<n<<" "<<m<<endl;
    bool matra[n+10][m+10];
    int poslSleva[n+10][m+10], poslSdesna[n+10][m+10], protok[n+10][m+10];

    for (int i=0; i<n; i++)
    {
        int p=-1;
        for (int j=0; j<m; j++)
        {
            cin>>matra[i][j];
            //cout<<matra[i][j]<<" "<<i<<" "<<j<<endl;
            poslSleva[i][j]=p;
            if (matra[i][j]) p=j;
            protok[i][j]=0;
        }
    }

    for (int i=0; i<n; i++)
    {
        int p=-1;
        for (int j=m-1; j>=0; j--)
        {
            poslSdesna[i][j]=p;
            if (matra[i][j]) p=j;
        }
    }

    for (int i=0; i<m; i++) protok[0][i]=1, protok[n][i]=0;
    for (int i=0; i<n; i++)
    {
        for (int j=0; j<m; j++)
        {
            if (protok[i][j]==0) continue;

            if (matra[i][j]==1) protok[i+1][j]+=protok[i][j];
            else
            {
                if (poslSdesna[i][j]==-1) protok[i+1][poslSleva[i][j]]+=protok[i][j];
                else if (poslSleva[i][j]==-1) protok[i+1][poslSdesna[i][j]]+=protok[i][j];
                else
                {
                    if (protok[i][j]%2==0)
                    {
                        protok[i+1][poslSdesna[i][j]]+=protok[i][j]/2;
                        protok[i+1][poslSleva[i][j]]+=protok[i][j]/2;
                    }
                    else
                    {
                        if (i%2==1) {
                            protok[i+1][poslSdesna[i][j]]+=protok[i][j]/2+1;
                            protok[i+1][poslSleva[i][j]]+=protok[i][j]/2;
                        }
                        else {
                            protok[i+1][poslSdesna[i][j]]+=protok[i][j]/2;
                            protok[i+1][poslSleva[i][j]]+=protok[i][j]/2+1;
                        }
                    }
                }
            }
        }
    }


    for (int i=0; i<m; i++) cout<<protok[n][i]<<" ";
    /*for (int i=0; i<=n; i++)
    {
        for (int j=0; j<m; j++)
            cout<<protok[i][j]<<" ";
        cout<<endl;
    }*/
}