#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int m, n;
  cin >> m >> n;
  vector<vector<int>> t(m, vector<int>(n));
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> t[i][j];
    }
  }
  vector<int> fin_t(m, 0);
  for (int i = 0; i < n; ++i) {
    int free_t = 0;
    for (int j = 0; j < m; ++j) {
      int start_t = max(free_t, fin_t[j]);
      fin_t[j] = start_t + t[j][i];
      free_t = fin_t[j];
    }
  }
  for (int i : fin_t) {
    cout << i << ' ';
  }
  cout << '\n';
  return 0;
}
