#include <bits/stdc++.h>

using namespace std;

int main() {

    int h, n;
    cin >> h >> n;

    pair<int, int> pos[h][n];
    int w[h][n], dp[h + 1][n];;
    for(int i = 0; i < h; i++) {
        for(int j = 0; j < n; j++) {
            cin >> w[i][j];
            dp[i + 1][j] = 0;

            if(w[i][j]) {
                pos[i][j].first = j;
                continue;
            }

            pos[i][j].first = (j ? pos[i][j - 1].first : -1);
        }

        for(int j = n - 1; j >= 0; j--) {
            if(w[i][j]) {
                pos[i][j].second = j;
                continue;
            }

            pos[i][j].second = (j < n - 1 ? pos[i][j + 1].second : pos[i][j].first);

            if(pos[i][j].first == -1)
                pos[i][j].first = pos[i][j].second;
        }
    }

    for(int i = 0; i < n; i++)
        dp[0][i] = 1;
    
    for(int i = 0; i < h; i++) {
        for(int j = 0; j < n; j++) {
            if(i & 1) {
                dp[i + 1][pos[i][j].first] += dp[i][j] / 2;
                dp[i + 1][pos[i][j].second] += (dp[i][j] + 1) / 2;
            } else {
                dp[i + 1][pos[i][j].first] += (dp[i][j] + 1) / 2;
                dp[i + 1][pos[i][j].second] += dp[i][j] / 2;
            }
        }
    }

    for(int i = 0; i < n; i++)
        cout << dp[h][i] << " ";
    cout << endl;
    return 0;
}