#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  vector<int> v(10, 0);
  int k;
  scanf("%d %d", &m, &n);
  for (int i = 0; i < m; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> k;
      v[j] = max(v[j], v[j - 1]) + k;
    }
    cout << v[n] << " ";
  }
}
