#include <bits/stdc++.h>
using namespace std;
void init() {
  long long m, n;
  cin >> m >> n;
  vector<vector<long long>> painting(m, vector<long long>(n));
  for (long long i = 0; i < m; i++)
    for (long long j = 0; j < n; j++) cin >> painting[i][j];
  vector<long long> finish(m);
  for (long long i = 0; i < n; i++) {
    long long freetime = 0;
    for (long long j = 0; j < m; j++) {
      long long st = max(freetime, finish[j]);
      finish[j] = st + painting[j][i];
      freetime = finish[j];
    }
  }
  for (auto x : finish) cout << x << " ";
}
int32_t main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  init();
  return 0;
}
