#include <bits/stdc++.h>
using namespace std;
int a[15], b[15];
int main() {
  int n, m;
  while (cin >> m >> n) {
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    while (m--) {
      for (int i = 1; i < n + 1; i++) cin >> a[i];
      int ans = 0;
      for (int i = 1; i < n + 1; i++) {
        if (ans > b[i])
          b[i] = ans;
        else if (ans < b[i])
          ans += b[i] - ans;
        ans += a[i];
        b[i] += a[i];
      }
      cout << ans;
      if (m) cout << ' ';
    }
    cout << endl;
  }
  return 0;
}
