#include <iostream>

using namespace std;

long w = 0, h = 0, kraj = 0;
long a[1000005],b[1000005],c[1000005];

long krajKamena(long i, long j){
    if(a[i * w + j + 1] == 1 || j + 1 == w)
        return (i * w + j);
    return krajKamena(i, j + 1);
}

int main()
{
    cin >> h >> w;

    for(long i = 0;i < h;i++){
        for(long j = 0;j < w;j++){
            cin >> a[i * w + j];
        }
    }

    for(long s = 0;s < w;s++)
        c[s] = 1;

    for(long i = 0;i < h;i++){
        for(long s = 0;s < w;s++)
            b[s] = c[s];

        for(long s = 0;s < w;s++)
            c[s] = 0;

        //cout << endl << endl << i << ". red ----------------------"<<endl << endl ;

        //for(long s = 0;s < w;s++)
        //   cout << a[i * w + s] << " ";

        for(long j = 0;j < w;j++){
            //cout << endl << j << ". trenutna kolona"<< endl;
            if(a[i * w + j] == 1){
                c[j] += b[j];
            }else{
                if(j == 0){//Ako je kamen uz levi zid
                    kraj = krajKamena(i, j) - i * w;

                    for(long s = 0;s <= kraj;s++){
                        c[kraj + 1] += b[s];
                    }
                    j = kraj;
                    //cout << "Kamen pocinje na levom zidu i zavrsava se u " << kraj << " i vrednost polja 1 je " << c[kraj + 1] << endl;
                    continue;
                }else if(krajKamena(i, j) - i * w == w - 1){
                    //cout << j << " kraj kamena je desni zid" << endl;

                    for(long s = j;s < w;s++){
                        c[j - 1] += b[s];
                    }
                    j = 0;
                    break;
                }else{
                    long temp = 0;
                    kraj = krajKamena(i, j) - i * w;

                    for(long s = j;s <= kraj;s++){
                        temp += b[s];
                    }
                    if(i % 2 == 0){ //LEVO
                        c[j - 1] += temp - temp / 2;
                        c[kraj + 1] += temp / 2;
                    }else{
                        c[j - 1] += temp / 2;
                        c[kraj + 1] += temp - temp / 2;
                    }

                    //cout << "Kamen pocinje u " << j << " a kraj mu je u "<< kraj << endl;

                    j = kraj;
                    continue;
                }
            }
        }

        //for(int s = 0;s < w;s++)
          // cout << c[s] << " ";
    }

    //cout << endl << "Krajni red je: \n";

    for(int s = 0;s < w;s++)
           cout << c[s] << " ";

    return 0;
}