#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> m >> n;
  int a[m][n];
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) cin >> a[i][j];
  }
  vector<int> f(m);
  for (int i = 0; i < n; i++) {
    int free = 0;
    for (int j = 0; j < m; j++) {
      int start = max(free, f[j]);
      f[j] = start + a[j][i];
      free = f[j];
    }
  }
  for (int i = 0; i < m; i++) {
    cout << f[i] << ' ';
  }
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
}
