#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char ch = getchar();
  long long nega = 1;
  while (!isdigit(ch)) {
    if (ch == '-') nega = -1;
    ch = getchar();
  }
  long long ans = 0;
  while (isdigit(ch)) {
    ans = ans * 10 + ch - 48;
    ch = getchar();
  }
  if (nega == -1) return -ans;
  return ans;
}
vector<long long> v[1000005];
long long a[1000005];
long long ans[1000005];
long long l[1000005], r[1000005], res[1000005];
long long c[1000005];
struct Node {
  long long pl, dat;
};
signed main() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    a[i] = read();
    v[i].push_back(a[i]);
    for (long long j = 0; j < a[i]; j++) {
      long long x = read();
      v[i].push_back(x);
      if (res[i] < x) res[i] = x;
    }
  }
  for (long long i = 1; i <= n; i++) {
    l[i] = a[i], r[i] = m - a[i] + 1;
    if (a[i] == m) {
      for (long long j = 1; j <= a[i]; j++) {
        ans[j] += v[i][j];
      }
      continue;
    }
    if (l[i] > r[i]) {
      deque<Node> q;
      for (long long j = 1; j <= m; j++) {
        if (j <= a[i]) {
          while (!q.empty() && v[i][j] > q.back().dat) q.pop_back();
        }
        while (!q.empty() && q.front().pl < j + a[i] - m) q.pop_front();
        if (j <= a[i]) q.push_back((Node){j, v[i][j]});
        if (j > l[i] || j < r[i])
          ans[j] += max(q.front().dat, 0LL);
        else
          ans[j] += q.front().dat;
      }
    } else if (l[i] < r[i]) {
      long long pre = 0;
      for (long long j = 1; j <= a[i]; j++) {
        if (v[i][j] > pre) pre = v[i][j];
        ans[j] += pre;
      }
      pre = 0;
      for (long long j = m, k = 1; j >= m - a[i] + 1; j--, k++) {
        if (v[i][a[i] - k + 1] > pre) pre = v[i][a[i] - k + 1];
        ans[j] += pre;
      }
      c[l[i] + 1] += res[i], c[r[i]] -= res[i];
    } else {
      long long pre = 0;
      for (long long j = 1; j <= a[i]; j++) {
        if (v[i][j] > pre) pre = v[i][j];
        ans[j] += pre;
      }
      pre = 0;
      for (long long j = m, k = 1; j > m - a[i] + 1; j--, k++) {
        if (v[i][a[i] - k + 1] > pre) pre = v[i][a[i] - k + 1];
        ans[j] += pre;
      }
    }
  }
  long long tmp = 0;
  for (long long i = 1; i <= m; i++) {
    tmp += c[i];
    printf("%lld ", tmp + ans[i]);
  }
  cout << "\n";
  return 0;
}
