#include <stdio.h>
#include <vector>
using namespace std;

int main(int argc, const char * argv[]) {
    
    int h,n,pom=0,k;
    scanf("%d%d",&h,&n);
    vector<vector<int>> a(h+2,vector<int> (n+1));
    vector<vector<int>> b(h+2,vector<int> (n+1));
    for(int i=1;i<=h;i++)
        for(int j=1;j<=n;j++)
            scanf("%d",&b[i][j]);
    for(int i=1;i<=n;i++)
        a[1][i]=1;
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(b[i][j])
            {
                a[i+1][j]+=a[i][j];
            }
            else
            {
                pom+=a[i][j];
                for(k=j+1;k<=n;k++)
                {
                   if(!b[i][k])
                       pom+=a[i][k];
                   else break;
                }
                if(k>n)
                    a[i+1][j-1]+=pom;
                else if(j==1)
                    a[i+1][k]+=pom+a[i][k];
                else
                {
                    if(i%2)
                    {
                        a[i+1][j-1]+=pom%2+pom/2;
                        a[i+1][k]+=pom/2+a[i][k];
                        
                    }
                    else
                    {
                        a[i+1][j-1]+=pom/2;
                        a[i+1][k]+=pom%2+pom/2+a[i][k];
                    }
                }
                pom=0;
                j=k;
            }
        }

    }
    for(int i=1;i<=n;i++)
      printf("%d ",a[h+1][i]);
    return 0;
}