#include <bits/stdc++.h>
using namespace std;
int t[50100][10];
long long p[50100][10];
int main() {
  int m, n;
  scanf("%d%d", &m, &n);
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) scanf("%d", &t[i][j]);
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++)
      p[i][j] = max(p[i - 1][j], p[i][j - 1]) + (long long)t[i][j];
  for (int i = 1; i <= m; i++) printf("%lld ", p[i][n]);
  return 0;
}
