#include <iostream>
using namespace std;
int main()
{
    int n,m;
    bool redpar;
    bool protokpar;
    cin>>n>>m;
    int put[n][m];
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            cin>>put[i][j];
    int protok[n+1][m]={0};
    for(int i=0;i<m;i++)
        protok[0][i]=1;
     for(int i=1;i<=n;i++)
        for(int j=0;j<m;j++)
        {
            if(i%2==0)
                redpar=true;
            else
                redpar=false;
            if(protok[i-1][j]%2==0)
                protokpar=true;
            else
                protokpar=false;
            if(put[i-1][j]==1)
                protok[i][j]+=protok[i-1][j];
            else
            {
                if(protokpar)
                {
                    if(j==0)
                        protok[i][j+1]+=protok[i-1][j];
                    else if(j==m-1)
                        protok[i][j-1]+=protok[i-1][j];
                    else
                    {
                        protok[i][j+1]+=protok[i-1][j]/2;
                        protok[i][j-1]+=protok[i-1][j]/2;
                    }
                }
                else
                {
                    if(j==0)
                        protok[i][j+1]+=protok[i-1][j];
                    else if(j==m-1)
                        protok[i][j-1]+=protok[i-1][j];
                    else
                    {
                        if(redpar)
                        {
                            protok[i][j+1]++;
                            protok[i][j+1]+=(protok[i-1][j]-1)/2;
                            protok[i][j-1]+=(protok[i-1][j]-1)/2;
                        }
                        else
                        {
                            protok[i][j-1]++;
                            protok[i][j+1]+=(protok[i-1][j]-1)/2;
                            protok[i][j-1]+=(protok[i-1][j]-1)/2;
                        }
                    }
                }
            }
        }
    for(int i=0;i<m;i++)
        cout<<protok[n][i]<<" ";
    return 0;
}