#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = (int) 1e6+99;
int h, n;
vector<vector<int> > mat;
vector<vector<pair<int, int> > > stene;
vector<int> tren, parc;
int main() {
    IOS; cin >> h >> n;
    for(int i=0; i<h; ++i) {
        vector<int> p;
        vector<pair<int, int> > q;
        for(int j=0; j<n; ++j)
        {int b; cin >> b; p.push_back(b);}
        mat.push_back(p);
        int duz=0, poc=-1;
        for(int j=0; j<n; ++j) {
            if(!p[j]) {
                if(duz==0) poc=j;
                ++duz;
            }
            else {
                if(duz!=0) q.push_back(make_pair(poc, poc+duz-1));
                duz=0;
            }
        }
        if(duz!=0) q.push_back(make_pair(poc, poc+duz-1));
        stene.push_back(q);
    }
    tren.resize(n, 1);
    parc.resize(n, 0);
    iota(parc.begin(), parc.end(), 1);
    for(int i=0; i<h; ++i) {
        /*for(auto x:tren) cout << x << ' ';
        cout << endl;*/
        for(int j=0; j<stene[i].size(); ++j) {
            for(int k=stene[i][j].first; k<=stene[i][j].second; ++k) tren[k] = 0;
            int uk = parc[stene[i][j].second]-(stene[i][j].first-1 >= 0 ? parc[stene[i][j].first-1]:0);
            if(stene[i][j].first == 0) {tren[stene[i][j].second+1]+=uk; continue;}
            if(stene[i][j].second == n-1) {tren[stene[i][j].first-1]+=uk; continue;}
            tren[stene[i][j].first-1] += uk/2 + ((i%2==0&&uk%2==1)?1:0);
            tren[stene[i][j].second+1] += uk/2 + ((i%2==1&&uk%2==1)?1:0);
        }
        parc[0] = tren[0];
        for(int j=1; j<n; ++j) parc[j] = parc[j-1] + tren[j];
    }
    for(auto x:tren) cout << x << ' ';
    return 0;
}