#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n;
  int t[50100][10];
  int tt[50100];
  cin >> m >> n;
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> t[i][j];
    }
  }
  tt[0] = t[0][0];
  for (int i = 1; i < m; ++i) tt[i] = tt[i - 1] + t[i][0];
  for (int j = 1; j < n; ++j) {
    tt[0] += t[0][j];
    for (int i = 1; i < m; ++i)
      if (tt[i] <= tt[i - 1])
        tt[i] = tt[i - 1] + t[i][j];
      else
        tt[i] += t[i][j];
  }
  for (int i = 0; i < m; ++i) cout << tt[i] << " ";
  return 0;
}
