#include <bits/stdc++.h>
using namespace std;
long long im[60000][10];
int main() {
  long long m, n, i, j, x, MAX;
  cin >> m >> n;
  for (i = 1; i <= m; i++) {
    for (j = 1; j <= n; j++) {
      cin >> x;
      MAX = max(im[i - 1][j], im[i][j - 1]);
      im[i][j] = MAX + x;
    }
  }
  for (i = 1; i <= m; i++) {
    cout << im[i][n] << " ";
  }
  return 0;
}
