#include <iostream>

using namespace std;

int a[100000];

int main()
{
    int h,n;
    cin >> h >> n;
    for(int j = 0;j < n;j++)
    {
        a[j] = 1;
    }

    int ac = 0;
    bool nule = false;
    int p = -1;
    for(int i = 1;i <= h;i++)
    {
        for(int j = 0;j < n;j++)
        {
            int c;
            cin >> c;
            if(c == 0)
            {
                ac += a[j];
                a[j] = 0;
                if(nule == false)
                {
                    p = j;
                    nule = true;
                }
                if(j == n-1)
                {
                    a[p-1] += ac;
                    nule = false;
                    ac = 0;
                }
            }
            else
            {
                if(nule == true)
                {
                    if(p == 0)
                        a[j] += ac;
                    else
                    {
                        a[p-1] += ac/2;
                        a[j] += ac/2;
                        if(ac%2 == 1)
                        {
                            if(i%2 == 1)
                            {
                                a[p-1] += 1;
                            }
                            else
                            {
                                a[j] += 1;
                            }
                        }   
                    }
                    ac = 0;
                    nule = false;
                }
            }
        }
    }
    for(int j = 0;j < n;j++)
    {
        cout << a[j] << " ";
    }
}