#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  while (~scanf("%d%d", &m, &n)) {
    int s[20] = {0};
    int a[m][n];
    for (int i = 1; i <= m; i++) {
      for (int j = 0; j < n; j++) {
        scanf("%d", &a[i][j]);
      }
    }
    for (int i = 1; i <= m; i++) {
      k = 0;
      for (int j = 0; j < n; j++) {
        k = max(s[j], k) + a[i][j];
        s[j] = k;
      }
      printf("%d ", k);
    }
    printf("\n");
  }
  return 0;
}
