#include <bits/stdc++.h>
using namespace std;
const int maxn = 1 * 1000 * 1000 + 10, inf = 1 * 1000 * 1000 * 1000 + 10;
int n, w, l[maxn], mx[maxn], x[maxn], ind[maxn], dp[maxn], cnt, ci, L, R, ql,
    qr, dpl[maxn];
long long ans[maxn], cur, a[maxn], tmx;
vector<pair<int, int>> tmp;
int main() {
  memset(dp, -1, sizeof dp);
  memset(dpl, -1, sizeof dpl);
  ios::sync_with_stdio(0);
  scanf("%d %d", &n, &w);
  for (int i = 0; i < n; i++) {
    scanf("%d", &l[i]);
    ind[i + 1] = ind[i] + l[i];
    for (int j = 0; j < l[i]; j++) {
      scanf("%d", &x[cnt]);
      while ((((int)tmp.size())) > 0 && tmp.back().first <= x[cnt]) {
        dp[tmp.back().second] = cnt;
        tmp.pop_back();
      }
      tmp.push_back({x[cnt], cnt});
      mx[i] = max(mx[i], x[cnt]);
      cnt++;
    }
    tmp.clear();
    ql = qr = -1;
    ci = ind[i];
    for (int j = 0; j < w; j++) {
      tmx = -inf;
      L = j - w + l[i];
      R = j;
      if (L <= 0 && R >= l[i] - 1 && R - L >= l[i]) {
        ql = j;
        break;
      }
      while (ci < cnt && dp[ci] <= R + ind[i] && dp[ci] != -1) ci = dp[ci];
      if (L + ind[i] - 1 == ci) {
        ci++;
        while (ci < cnt && dp[ci] <= R + ind[i] && dp[ci] != -1) ci = dp[ci];
      }
      if (ci < cnt) tmx = x[ci];
      if (L < 0 || R >= l[i]) tmx = max(tmx, (long long)0);
      ans[j] += tmx;
    }
    if (ql != -1) {
      ci = cnt - 1;
      for (int j = cnt - 1;; j--) {
        if (j >= ind[i]) {
          while ((((int)tmp.size())) > 0 && tmp.back().first <= x[j]) {
            dpl[tmp.back().second] = j;
            tmp.pop_back();
          }
          tmp.push_back({x[j], j});
        }
        tmx = -inf;
        L = j;
        R = j + w - l[i];
        if (L - ind[i] <= 0 && R - ind[i] >= l[i] - 1 && R - L >= l[i]) {
          qr = j + w - cnt + 1;
          break;
        }
        while (ci >= ind[i] && dpl[ci] >= L && dpl[ci] != -1) ci = dpl[ci];
        if (ci == R + 1) {
          ci--;
          while (ci >= ind[i] && dpl[ci] >= L && dpl[ci] != -1) ci = dpl[ci];
        }
        if (ci >= ind[i]) tmx = x[ci];
        if (L - ind[i] < 0 || R - ind[i] >= l[i]) tmx = max(tmx, (long long)0);
        ans[j + w - cnt] += tmx;
      }
    }
    if (ql != -1) {
      a[ql] += mx[i];
      a[qr] -= mx[i];
    }
  }
  for (int i = 0; i < w; i++) {
    cur += a[i];
    printf("%lld ", cur + ans[i]);
  }
  return 0;
}
