#include <bits/stdc++.h>
using namespace std;
const int N = 10, M = 50505;
long long m, n, t[M][N], ans[M];
int main() {
  cin >> m >> n;
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++) cin >> t[i][j];
  for (int i = 0; i < n; i++) {
    ans[0] += t[0][i];
    for (int j = 1; j < m; j++) {
      if (ans[j - 1] > ans[j]) ans[j] = ans[j - 1];
      ans[j] += t[j][i];
    }
  }
  for (int i = 0; i < m; i++) cout << ans[i] << ' ';
  return 0;
}
