#include <bits/stdc++.h>
using namespace std;
long long int a[100000][10];
long long int dp[100000][10];
int main() {
  long long int n, i, j, k, sum, ans, store, x, y, m, p, r, g, b, t, q;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      scanf("%I64d", &p);
      a[i][j] = p;
      dp[i][j] = p;
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (j == 1)
        dp[i][j] = dp[i - 1][j] + a[i][j];
      else {
        p = dp[i - 1][j];
        q = dp[i][j - 1];
        p = max(p, q);
        dp[i][j] = p + a[i][j];
      }
    }
  }
  for (i = 1; i <= n; i++) cout << dp[i][m] << " ";
}
