#include <bits/stdc++.h>

using namespace std;

#define pii pair<int,int>
#define ll long long
#define s second
#define f first

int h,n;

void Print(vector<int>& a){
 for(int x:a){
    cout << x << " ";
 }
 cout << endl;
}

vector<int> Normal(int x,int y,vector<vector<int>>& mat){
   vector<int> prev(y,1),nxt(y,0);
   for(int i=0;i<x;++i){
    for(int j=0;j<y;++j){
        if(mat[i][j]){nxt[j]+=prev[j];continue;}
        int pom=0,r=j;
        while(r<y && !mat[i][r]){
            pom+=prev[r];
            ++r;
        }
        --r;
        if(j==0){
            nxt[r+1]+=pom;
        }
        else if(r==y-1){
            nxt[j-1]+=pom;
        }
        else{
            nxt[j-1]+=pom/2;
            nxt[r+1]+=pom/2;
            if(i%2){
                nxt[r+1]+=pom%2;
            }else{
             nxt[j-1]+=pom%2;
            }
        }
        j=r;
     }
     prev=nxt;
     nxt=vector<int>(y,0);
   }
  return prev;
}



int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  cin >> h >> n;
  vector<vector<int>> mat(h,vector<int>(n,0));
  for(int i=0;i<h;++i){
    for(int j=0;j<n;++j){
      cin >> mat[i][j];
    }
  }
  vector<int> a=Normal(h,n,mat);
  Print(a);
  return 0;
}