#include <stdio.h>

int main(void) {
  int h,n,i=0,j=0,k=0,prevHole =-1;
  scanf("%d %d",&h,&n);
  int protok [n];
  int vodopad [h][n];
  
  while(i<h){
    while(j<n){
      scanf("%d",&vodopad[i][j]);
      j++;
      protok[j]=1;
      
    }
    i++;
    j=0;
  }
  i = 0;
  while(i<h){
    while(j<n){
      if(vodopad[i][j] == 0){
        if(!j){//dobro
          k = j;
          while(k<n&&k!=-1){
            k++;
            if(vodopad [i][k-1]==1){
              protok[k]+=protok[j+1];
              k=-1;
            }
          }
          k=0;
          protok[j+1]=0;
        }
        else if(j==n-1){//dobro
          protok[prevHole+1]+=protok[j+1];
          protok[j+1]=0;
        }
        else if(prevHole==-1){
          k = j;
          while(k++<n&&k!=-1){
            if(vodopad [i][k]==1){
              protok[k+1]+=protok[j+1];
            }
          }
          k=0;
          protok[j+1]=0;
        }
        else if(protok[j+1]%2==0){//dobro
          k = j;
          while(k<n&&k!=-1){
            k++;
            if(vodopad [i][k-1]==1){
              protok[k]+=protok[j+1]/2;
              protok[prevHole+1]+=protok[j+1]/2;
              k=-1;
            }
          }
          if(k>=n){
            
            protok[prevHole+1]+=protok[j+1];
          }
            
          k=0;
          protok[j+1]=0;
        }
        else if(i%2==0){
          
          k = j;
          while(k<n&&k!=-1){
            k++;
            if(vodopad [i][k-1]==1){
              //printf("woop");
              protok[k]+=protok[j+1]/2;
              protok[prevHole+1]+=protok[j+1]/2+1;
              k=-1;
            }
          }
          if(k>=n)
            protok[prevHole+1]+=protok[j+1];
          k=0;
          
          protok[j+1]=0;
        }
        else {
          k = j;
          while(k<n&&k!=-1){
            k++;
            if(vodopad [i][k-1]==1){
              protok[k]+=protok[j+1]/2+1;
              protok[prevHole+1]+=protok[j+1]/2;
              k=-1;
            }
          }
          if(k>=n)
            protok[prevHole+1]+=protok[j+1];
          k=0;
          protok[j+1]=0;
        }
      }
      else{
        prevHole = j;
      }
      j++;
    }
    prevHole = -1;
    j = 0;
    i++;
  }
  //printf("\n");
  while(k++<n){
    printf("%d ",protok[k]);
  }
  
  return 0;
}