//Failure will never overtake me if my determination to succeed is strong enough
#include <bits/stdc++.h>

using namespace std;

int a[1000005];
int l[1000005], d[1000005], r[1000005], tmpr[1000005];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int h, n;
    cin >> h >> n;

    for(int i = 0; i < n; i++)
        r[i] = 1;

    int red = 1;
    while(h--)
    {
        for(int i = 0; i < n; i++)
            tmpr[i] = 0;

        for(int i = 0; i < n; i++)
        {
            cin >> a[i];
        }

        for(int i = 0; i < n; i++)
        {
            if(i == 0 && a[i] == 0)
                l[i] = -1;
            else if(a[i])
                l[i] = i;
            else
                l[i] = l[i-1];
        }

        for(int i = n-1; i >= 0; i--)
        {
            if(i == n-1 && a[i] == 0)
                d[i] = -1;
            else if(a[i])
                d[i] = i;
            else
                d[i] = d[i+1];
        }

//        for(int i = 0; i < n; i++)
//            cout << l[i] << " ";
//        cout << endl;
//        for(int i = 0; i < n; i++)
//            cout << d[i] << " ";
//        cout << endl;
//        cout << endl;

        for(int i = 0; i < n; i++)
        {
            if(l[i] == -1)
                tmpr[d[i]] += r[i];

            else if(d[i] == -1)
                tmpr[l[i]] += r[i];

            else
            {
                tmpr[l[i]] += r[i]/2;
                tmpr[d[i]] += r[i]/2;

                if(r[i]%2)
                {
                    if(red%2)
                        tmpr[l[i]] += 1;
                    else
                        tmpr[d[i]] += 1;
                }
            }
        }

        for(int i = 0; i < n; i++)
            r[i] = tmpr[i];
        red++;
    }

    for(int i = 0; i < n; i++)
        cout << r[i] << " ";

}