#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 100;
const long long maxn = 1048576;
long long N, W;
long long n[maxn], m[maxn];
long long mx[maxn];
long long nn;
long long a[maxn];
long long l[maxn], r[maxn];
long long M[maxn * 2];
long long I[maxn];
long long p[maxn];
bool cmp(long long i, long long j) { return n[i] < n[j]; }
void make(long long nod, long long ls, long long rs) {
  if (rs - ls == 1) {
    M[nod] = a[ls];
    return;
  }
  make((nod * 2 + 1), ls, ((ls + rs) >> 1));
  make((nod * 2 + 2), ((ls + rs) >> 1), rs);
  M[nod] = max(M[(nod * 2 + 1)], M[(nod * 2 + 2)]);
}
long long fnd(long long nod, long long ls, long long rs, long long l,
              long long r) {
  if (rs <= l or r <= ls) return -inf;
  if (l <= ls and rs <= r) return M[nod];
  return max(fnd((nod * 2 + 1), ls, ((ls + rs) >> 1), l, r),
             fnd((nod * 2 + 2), ((ls + rs) >> 1), rs, l, r));
}
long long get(long long i, long long l, long long r) {
  return fnd(0, 0, nn, ::l[i] + l, ::l[i] + r);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> W;
  for (long long i = 0; i < N; i++) {
    cin >> n[i];
    m[i] = n[i];
    l[i] = nn;
    nn += n[i];
    r[i] = nn;
    for (long long j = l[i]; j < r[i]; j++) {
      cin >> a[j];
      mx[i] = max(mx[i], a[j]);
    }
    I[i] = i;
  }
  make(0, 0, nn);
  sort(I, I + N, cmp);
  sort(m, m + N);
  for (long long i = 0; i < N; i++) p[i + 1] += p[i] + mx[I[i]];
  for (long long i = 0; i < W; i++) {
    long long ans = 0;
    long long d = min(i + 1, W - i);
    long long D = max(i + 1, W - i);
    long long j = lower_bound(m, m + N, d) - m;
    ans += p[j];
    for (long long k = j; k < N; k++) {
      long long K = I[k];
      long long c = get(K, max(0ll, n[K] - (W - i)), min(n[K], i + 1));
      if (n[K] < D) c = max(c, 0ll);
      ans += c;
    }
    cout << ans << " ";
  }
  cout << endl;
  return 0;
}
