using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            var data = line.Split(' ');
            int h = int.Parse(data[0]);
            int n = int.Parse(data[1]);
            int[,] mat = new int[h, n+1];
            for (int i = 0; i < h; i++) mat[i, n] = 1;
            for (int i = 0; i < h; i++)
            {
                line = Console.ReadLine();
                data = line.Split(' ');
                for(int j = 0; j < n; j++) mat[i,j] = int.Parse(data[j]);
            }
            int[,] voda = new int[h + 1, n];
            for (int i = 0; i < n; i++) voda[0, i] = 1;
            for (int i = 1; i <= h; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    if (mat[i - 1, j] == 1) voda[i, j] += voda[i - 1, j];
                    else
                    {
                        int zb = voda[i - 1, j];
                        int poc = j;
                        int duz = 1;
                        if (j != n-1)
                        while ((mat[i - 1, j + 1] == 0) && (j < n - 1))
                        {
                            zb += voda[i - 1, j + 1];
                            duz++;
                            j++;
                        }
                        if ((poc == 0) && (j < n - 1)) voda[i, duz] += zb;
                        else if ((j == n - 1) && (poc > 0)) voda[i, poc - 1] += zb;
                        else
                        {
                            voda[i, poc - 1] += zb / 2;
                            voda[i, poc + duz] += zb / 2;
                            if ((i % 2 == 0) && (zb % 2 == 1)) voda[i, poc + duz]++;
                            if ((i % 2 == 1) && (zb % 2 == 1)) voda[i, poc - 1]++;
                        }
                    }
                }
            }
            for (int i = 0; i < n; i++) Console.Write(voda[h, i] + " ");
            Console.ReadLine();
        }
    }
}