#include <bits/stdc++.h>
using namespace std;
int M, N;
int T;
int FT[50005][10];
int main() {
  cin >> M >> N;
  for (int i = 0; i < M; i++)
    for (int j = 0; j < N; j++) {
      cin >> T;
      FT[i + 1][j + 1] = T + max(FT[i][j + 1], FT[i + 1][j]);
    }
  for (int i = 1; i <= M; i++) cout << FT[i][N] << ' ';
  cout << endl;
}
