#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const int N = 1e6 + 7;
long long a[N];
int main() {
  int n, m;
  cin >> n >> m;
  int t;
  for (long long i = 1; i < (int)n + 1; i++) {
    for (long long j = 1; j < (int)m + 1; j++) {
      cin >> t;
      a[j] = max(a[j], a[j - 1]) + t;
    }
    cout << a[m] << " ";
  }
  return 0;
}
