#include<bits/stdc++.h>

using namespace std;

int n, m;
vector<int> ans, a;

int main(){
	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
	cin >> n >> m;
	ans.resize(m+1, 1);
	ans[0] = -1;
	for(int i = 1; i <= n; ++i){
		a.clear();
		a.resize(m+1, 0);
		for(int j = 1; j <= m; ++j){
			cin >> a[j];
		}
		vector<int> tmp = ans;
		for(int j = 1; j <= m; ++j){
			if(a[j] == 0){
				int lF = j-1, rF, tmpF = 0;
				while(a[j] == 0){
					tmpF += tmp[j];
					tmp[j] = 0;
					++j;
				}
				rF = j;
				if(!lF){
					tmp[rF] += tmpF;
				} else if(rF > m){
					tmp[lF] += tmpF;
				} else {
					tmp[lF] += tmpF/2;
					tmp[rF] += tmpF/2;
					if(i&1){
						tmp[lF] += tmpF&1;
					} else {
						tmp[rF] += tmpF&1;
					}
				}
			}
		}
		ans = tmp;
	}
	for(auto i : ans){
        if(i < 0){
            continue;
        }
        cout << i << ' ';
	}
}