#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> m >> n;
  vector<vector<int> > nums(m + 1, vector<int>(n + 1));
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> nums[i][j];
    }
  }
  vector<int> finishTime(m + 1);
  for (int i = 1; i <= n; i++) {
    int free = 0;
    for (int j = 1; j <= m; j++) {
      int start = max(free, finishTime[j]);
      finishTime[j] = start + nums[j][i];
      free = finishTime[j];
    }
  }
  for (int i = 1; i <= m; i++) cout << finishTime[i] << " ";
}
