#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long MAX = 1e5 + 5;
const long long MAX2 = 11;
const int MOD = 1000000000 + 7;
const long long INF = 20000;
const int nr[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int nc[] = {0, 0, 1, -1, 1, -1, 1, -1};
int n, m, x, ls[6];
int main() {
  cout << fixed << setprecision(10);
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  while (n--) {
    for (int i = 1; i <= m; i++) {
      cin >> x;
      ls[i] = max(ls[i], ls[i - 1]) + x;
    }
    cout << ls[m] << " ";
  }
  return 0;
}
