#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int h,n,x;
int niz[1000000];
int main()
{
  cin>>h;
  cin>>n;
  for (int j = 0; j < n; j++)
        {
            niz[j]=1;
        }

  vector<vector<int> > vec( h , vector<int> (n));
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < n; j++)
        {
            cin>>vec[i][j];
        }
    }
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if(vec[i][j]==0)
            {

                x=niz[j];
                niz[j]=0;
                int levi=j-1,desni=j+1;
                while(levi>=0 && vec[i][levi]==0)
                    levi--;
                while(desni<n && vec[i][desni]==0)
                    desni++;
                if(desni<n && levi>=0)
                {
                    if(x%2==0)
                    {
                        niz[levi]+=x/2;
                        niz[desni]+=x/2;
                    }
                    else
                    {
                        if((i+1)%2==1)
                        {
                            niz[levi]+=x/2+1;
                            niz[desni]+=x/2;
                        }
                        else
                        {
                            niz[levi]+=x/2;
                            niz[desni]+=x/2+1;
                        }
                    }
                }
                else
                {
                    if(desni<=n-1)
                    {
                      niz[desni]+=x;
                    }
                    if(levi>=0)
                    {
                       niz[levi]+=x;
                    }
                }

            }
        }
    }
    for(int i=0;i<n;i++)
    {
        cout<<niz[i]<<" ";
    }
}