#include <iostream>

long long unsigned n,m;

void refine(bool* a,long unsigned* b,unsigned f){
  unsigned bg=m,ed=m,sm=0;
  for(unsigned i=0;i<m;i++)
    if(!a[f*m+i]){
      sm=0;
      bg=i;
      while(!a[f*m+i]&&i<m){
        sm+=b[(f-1)*m+i];
        i++;
      }
      ed=i-1;
    if(bg!=m&& ed!=m){
      if(bg==0)b[f*m+ed+1]+=sm;
      else if(ed==m-1)b[f*m+bg-1]+=sm;
      else{
      b[f*m+bg-1]+=sm/2;
      b[f*m+ed+1]+=sm/2;
      if(sm%2!=0&&sm!=0){
        if(f%2==0)b[f*m+ed+1]++;
        else b[f*m+bg-1]++;
      }
      }
      }
    bg=m;ed=m;
    }
}

int main(){
  std::ios::sync_with_stdio(false); 
  std::cin>>n>>m;
  bool a[n+1][m];
  long unsigned b[n+1][m];
  for(unsigned i=0;i<m;i++){a[0][i]=1;b[0][i]=1;}
  for(unsigned i=1;i<=n;i++)
    for(unsigned j=0;j<m;j++){std::cin>>a[i][j];b[i][j]=0;}
  
  for(unsigned i=1;i<=n;i++){
    for(unsigned j=0;j<m;j++)
    if(a[i][j])b[i][j]+=b[i-1][j];
    refine(a[0],b[0],i);
    }

    for(unsigned j=0;j<m;j++)std::cout<<b[n][j]<<' ';
}