#include <bits/stdc++.h>
using namespace std;
vector<long long> a[1000000];
long long l[1000000], r[1000000];
long long n, w;
const long long INF = -1e9;
struct ST {
  struct node {
    node *L, *R;
    long long val;
    node(vector<long long> &v, long long il, long long ir) {
      if (ir - il == 1) {
        val = v[il];
        return;
      }
      L = new node(v, il, (il + ir) / 2);
      R = new node(v, (il + ir) / 2, ir);
      val = max(L->val, R->val);
      return;
    }
    void upd(long long p, long long x, long long l, long long r) {
      if (p < l || p >= r) return;
      if (l == r - 1) {
        val = x;
        return;
      }
      L->upd(p, x, l, (l + r) / 2);
      R->upd(p, x, (l + r) / 2, r);
      val = max(L->val, R->val);
    }
    long long segmin(long long lb, long long rb, long long l, long long r) {
      if (rb <= l || lb >= r) {
        return INF;
      }
      if (lb <= l && rb >= r) {
        return val;
      }
      return max(L->segmin(lb, rb, l, (l + r) / 2),
                 R->segmin(lb, rb, (l + r) / 2, r));
    }
  };
  node *R;
  long long sz;
  vector<long long> arr;
  ST(vector<long long> v) {
    sz = v.size();
    R = new node(v, 0, sz);
    arr = v;
  }
  long long seg_max(long long l, long long r) {
    if (l >= r) return 0;
    return R->segmin(l, r, 0, sz);
  }
};
vector<ST> t;
void solve() {
  long long ans = 0;
  for (long long i = 0; i < w; i++) {
    for (long long j = n - 1; j >= 0; j--) {
      if (i >= a[j].size()) break;
      ans -= t[j].seg_max(l[j], r[j]);
      r[j] = i + 1;
      ans += t[j].seg_max(l[j], r[j]);
    }
    for (long long j = n - 1; j >= 0; j--) {
      if (w - i >= a[j].size()) break;
      ans -= t[j].seg_max(l[j], r[j]);
      l[j] = i - (w - a[j].size());
      ans += t[j].seg_max(l[j], r[j]);
    }
    if (i != 0 && i != w - 1) cout << ans << ' ';
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> w;
  for (long long i = 0; i < n; i++) {
    long long l;
    cin >> l;
    a[i].resize(l + 2);
    a[i][0] = 0, a[i][l + 1] = 0;
    for (long long j = 1; j <= l; j++) cin >> a[i][j];
  }
  sort(a, a + n, [](vector<long long> &u, vector<long long> &v) {
    return (u.size() < v.size());
  });
  w += 2;
  for (long long i = 0; i < n; i++) t.push_back(ST(a[i]));
  solve();
}
