#include <bits/stdc++.h>
using namespace std;

#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    ll h, n;
    cin >> h >> n;

    bool mat[h][n];
    ll res[h + 1][n];
    for(ll i = 0; i < h; ++i){
        for(ll j = 0; j < n; ++j){
            cin >> mat[i][j];
            res[i][j] = (i == 0 ? 1 : 0);
        }
    }

    for(ll i = 0; i < n; ++i){res[h][i] = 0;}

    for(ll i = 0; i < h; ++i){
        ll f = -1;
        ll cnt = 0;
        for(ll j = 0; j < n; ++j){
            if(!mat[i][j]){
                cnt += res[i][j];
            }
            else{
                if(cnt){
                    if(f == -1){res[i + 1][j] += cnt;}
                    else{
                        res[i + 1][f] += cnt / 2;
                        res[i + 1][j] += cnt / 2;
                        if(i % 2){res[i + 1][j] += cnt % 2;}
                        else{res[i + 1][f] += cnt % 2;}
                    }
                    cnt = 0;
                }
                res[i + 1][j] += res[i][j];
                f = j;
            }
        }

        if(cnt){
            res[i + 1][f] += cnt;
        }
    }

    for(ll i = 0; i < n; ++i){
        cout << res[h][i] << " ";
    }

    return 0;
}