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

#define ra " "

int main()
{
    int n,h,left,right,sum;
    cin>>n>>h;
    vector<int> v(h+1);
    v[h]=1;
    vector<int> ans(h,1);
    for(int i=0; i<n; ++i) {
        for(int j=0; j<h; ++j) {
            cin>>v[j];
        }
        for(int j=0; j<h; ++j) {
            if(v[j]==0) {
                left=j;
                sum=0;
                while(v[j]==0) sum+=ans[j], j++;
                right=j-1;
                if(left==0) {
                    ans[right+1]+=sum;
                }
                else if(right==h-1) ans[left-1]+=sum;
                else if(sum%2==1) {
                    ans[left-1]+=sum/2;
                    ans[right+1]+=sum/2;
                    if(i%2==0) ans[left-1]++;
                    else ans[right+1]++;
                }
                else if(sum%2==0) ans[right+1]+=sum/2, ans[left-1]+=sum/2;
                for(int k=left; k<=right; ++k) ans[k]=0;
            }
        }
    }
    for(int i=0; i<h; ++i) cout<<ans[i]<<ra;
    return 0;
}