#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int n, w;
int l[N], ara[N];
multiset<int> st[N];
vector<pair<int, int>> IN[N], OUT[N];
long long ans[N];
int main() {
  scanf("%d %d", &n, &w);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &l[i]);
    for (int j = 1; j <= l[i]; j++) scanf("%d", &ara[j]);
    for (int j = 1; j <= l[i]; j++) {
      int L = j;
      int R = L + w - l[i];
      IN[L].push_back(make_pair(i, ara[j]));
      OUT[R].push_back(make_pair(i, ara[j]));
    }
    IN[0].push_back(make_pair(i, 0));
    OUT[w - l[i]].push_back(make_pair(i, 0));
    IN[l[i] + 1].push_back(make_pair(i, 0));
    OUT[w + 1].push_back(make_pair(i, 0));
  }
  long long sum = 0;
  for (int j = 0; j <= w; j++) {
    for (int i = 0; i < IN[j].size(); i++) {
      int row = IN[j][i].first;
      int val = IN[j][i].second;
      if (st[row].size() > 0) sum = sum - *--st[row].end();
      st[row].insert(val);
      sum = sum + *--st[row].end();
    }
    if (j > 0) printf("%lld ", sum);
    for (int i = 0; i < OUT[j].size(); i++) {
      int row = OUT[j][i].first;
      int val = OUT[j][i].second;
      sum = sum - *--st[row].end();
      st[row].erase(st[row].find(val));
      if (st[row].size() > 0) sum = sum + *--st[row].end();
    }
  }
}
