#include <bits/stdc++.h>

using namespace std;

int n;
int m;

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cerr.tie(0);
    
    cin >> n >> m;
    
    int a[n+5][m+5];
    int protok[n+5][m+5];
    pair<int,int> gde[n+5][m+5];
    
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            {
                cin >> a[i][j];
                protok[i][j] = 0;
            }
    
    for(int i=1;i<=n;i++)
    {
        int zadnji = 0;
        for(int j=1;j<=m;j++)
        {
            if(a[i][j]) zadnji = j;
            else gde[i][j].first = zadnji;
        }
        zadnji = m+1;
        for(int j=m;j>=1;j--)
        {
            if(a[i][j]) zadnji = j;
            else gde[i][j].second = zadnji;
        }
    }
    
    for(int j=1;j<=m;j++) protok[0][j] = 1;
    
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(a[i][j]) protok[i][j]+=protok[i-1][j];
            else
            {
                int x = protok[i-1][j];
                int le = x/2;
                int de = x/2;
                int preko = (x%2==1) ? 1 : 0;
                
                if(i%2==1) le+=preko;
                else de+=preko;
                
                if(gde[i][j].first!=0) 
                {
                    protok[i][gde[i][j].first]+=le;
                    if(gde[i][j].second!=m+1) protok[i][gde[i][j].second]+=de;
                    else protok[i][gde[i][j].first]+=de;
                }
                else
                {
                    protok[i][gde[i][j].second]+=x;
                }
            }
        }
    }
    
    for(int j=1;j<=m;j++) cout << protok[n][j] << " ";
    
    return 0;
}