#include <bits/stdc++.h>
using namespace std;
int dp[60002][10];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int a;
  for (int j = 0; j < m; j++) {
    cin >> a;
    if (!j)
      dp[0][j] = a;
    else
      dp[0][j] = dp[0][j - 1] + a;
  }
  cout << dp[0][m - 1] << " ";
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a;
      if (!j)
        dp[i][j] = dp[i - 1][j] + a;
      else {
        if (dp[i - 1][j] >= dp[i][j - 1])
          dp[i][j] = dp[i - 1][j] + a;
        else
          dp[i][j] = dp[i][j - 1] + a;
      }
    }
    cout << dp[i][m - 1] << " ";
  }
}
