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

namespace ubijmepls
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,] A;
            string[] s;
            s = Console.ReadLine().Split();
            int n = Convert.ToInt32(s[0]);
            int h = Convert.ToInt32(s[1]);
            A = new int[n + 1, h];
            for (int i = 1; i < n + 1; i++)
            {
                s = Console.ReadLine().Split();
                for (int j = 0; j < h; j++)
                {
                    A[i, j] = Convert.ToInt32(s[j]);
                }
            }
            A[0, 0] = 1; A[0, 1] = 1; A[0, 2] = 1;
            for (int i = 0; i < n; i++)
            {
                int p = (i + 1) % 2;
                for (int j = 0; j < h; j++)
                {
                    int br = A[i, j] / 2;
                    int br1 = br + 1;
                    int p1 = A[i, j] % 2;
                    if (A[i + 1, j] == 0)
                    {
                        if (j == 0)
                            A[i, j + 1] += A[i, j];
                        else if (j == h - 1)
                            A[i, j - 1] += A[i, j];
                        else
                        {
                            switch (p1)
                            {
                                case 0:
                                    A[i, j - 1] += br;
                                    A[i, j + 1] += br;
                                    break;
                                default:
                                    switch (p)
                                    {
                                        case 0:
                                            A[i, j + 1] += br1;
                                            A[i, j - 1] += br;
                                            break;
                                        default:
                                            A[i, j + 1] += br;
                                            A[i, j - 1] += br1;
                                            break;
                                    }
                                    break;
                            }
                        }
                    }

                }
                
            }
            for (int i = 1; i < n + 1; i++)
            {
                for (int j = 0; j < h; j++)
                {
                    if (A[i, j] != 0)
                    {
                        A[i, j] = A[i - 1, j];
                    }
                }
            }

            for (int i = 0; i < h; i++)
            {
                Console.Write(A[n, i] + " ");
            }
        }
    }
}