#include <bits/stdc++.h>
using namespace std;
#pragma warning(disable : 4996)
const int INF = 1e9 + 1;
const long long LINF = 1e18 + 1;
const int MOD = 1000000007;
long long ans[1000001];
vector<pair<int, int> > add_element[1000001], remove_element[1000001];
multiset<int> global_ms[1000001];
int main() {
  int N, W;
  scanf("%d %d", &N, &W);
  for (int i = 0; i < N; i++) {
    int cnt;
    scanf("%d", &cnt);
    for (int j = 0; j < cnt; j++) {
      int x, l, r;
      scanf("%d", &x);
      add_element[j].push_back({x, i});
      remove_element[j + W - cnt].push_back({x, i});
    }
    if (cnt < W) {
      add_element[cnt].push_back({0, i});
      remove_element[W - 1].push_back({0, i});
      add_element[0].push_back({0, i});
      remove_element[W - 1 - cnt].push_back({0, i});
    }
  }
  for (int i = 0; i < W; i++) {
    for (auto j : add_element[i]) {
      int idx = j.second;
      int val = j.first;
      ans[i] -= (global_ms[idx].empty() ? 0 : *global_ms[idx].rbegin());
      global_ms[idx].insert(val);
      ans[i] += *global_ms[idx].rbegin();
    }
    if (i < W - 1) {
      ans[i + 1] = ans[i];
      for (auto j : remove_element[i]) {
        int idx = j.second;
        int val = j.first;
        ans[i + 1] -= (*global_ms[idx].rbegin());
        global_ms[idx].erase(global_ms[idx].find(val));
        ans[i + 1] += (global_ms[idx].empty() ? 0 : *global_ms[idx].rbegin());
      }
    }
    printf("%lld ", ans[i]);
  }
  puts("");
  return 0;
}
