#include <iostream>

using namespace std;

int main()
{
    long int n,h;
    cin>>h>>n;
    long int A[h][n],dp[h+1][n];
    for(int i=0;i<h;i++)
        for(int j=0;j<n;j++)
            cin>>A[i][j];
    for(long int j=0;j<n;j++) dp[0][j]=1;
    for(long int i=1;i<=h;i++)
    {
        for(long int j=0;j<n;j++)dp[i][j]=0;
        long int j=0,sumal=0;
        while(A[i-1][j]==0) {sumal+=dp[i-1][j]; j++;}
        long int jpoc=j; dp[i][jpoc]=dp[i-1][jpoc]+sumal;
        j=n-1;
        long int sumad=0;
        while(A[i-1][j]==0 && j>jpoc) {sumad+=dp[i-1][j];j--;}
        long int jkraj=j;
        dp[i][jkraj]+=sumad+((jpoc==jkraj)?0:dp[i-1][jkraj]);
        j=jpoc+1;
        while(j<jkraj)
        {
            if(A[i-1][j]){dp[i][j]+=dp[i-1][j]; j++;}
            else{
                long int jp=j,suma=0;
                while(A[i-1][j]==0) {suma+=dp[i-1][j]; j++;}
                long int jk=j;
                dp[i][jp-1]+=((suma/2)+(suma%2==1 && i%2==1));
                dp[i][jk]+=((suma/2)+(suma%2==1 && i%2==0));
            }
        }
    }
    for(int i=0;i<n;i++) cout<<dp[h][i]<<" ";
    return 0;
}