#include <iostream>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cerr.tie(0);
    int h,n;
    cin>>h>>n;
    int kamenje[h][n];
    for(int i=0;i<h;i++){
        for(int j=0;j<n;j++){
            cin>>kamenje[i][j];
        }
    }
    int oCount=0,oStart=0;
    int flow[h+1][n];
    for(int i=0;i<n;i++)flow[0][i]=1;
    for(int i=1;i<=h;i++){
        oCount=0;
        for(int j=0;j<n;j++){
            if(kamenje[i-1][j]==0){
                if(oCount==0){
                    oStart=j;
                    oCount=flow[i-1][j];
                }
                else{
                    oCount+=flow[i-1][j];
                }
                flow[i][j]=0;
            }
            else{
                flow[i][j]=flow[i-1][j];
                if(oCount>0){
                    if(oStart==0){
                        flow[i][j]+=oCount;
                    }
                    else{
                        flow[i][oStart-1]+=oCount/2;
                        flow[i][j]+=oCount/2;
                        if(oCount%2==1){
                            if(i%2==0){
                                flow[i][j]++;
                            }
                            else{
                                flow[i][oStart-1]++;
                            }
                        }
                    }
                    oCount=0;
                }
            }
        }
        if(oCount>0)flow[i][oStart-1]+=oCount;
    }
    for(int i=0;i<n-1;i++){
        cout<<flow[h][i]<<" ";
    }
    cout<<flow[h][n-1];
}