#include <bits/stdc++.h>
using namespace std;
int n, w;
vector<vector<int>> a;
long long diff[1000000];
void update_diff(vector<int> &v) {
  map<int, int> s;
  if (v.size() < w) s[0] = 1;
  s[v[0]]++;
  int mx = s.rbegin()->first;
  diff[0] += mx;
  bool out = v.size() < w;
  int l = 0;
  int r = 0;
  for (int i = 0; i < w; ++i) {
    if (i > v.size() + 3 && i + v.size() + 3 < w) {
      i = w - v.size() - 3;
      continue;
    }
    bool out_new = false;
    int l_new = i - (w - v.size());
    if (l_new < 0) {
      l_new = 0;
      out_new = true;
    }
    int r_new = i;
    if (r_new >= v.size()) {
      r_new = v.size() - 1;
      out_new = true;
    }
    if (out_new && !out) s[0]++;
    if (!out_new && out) {
      if (--s[0] == 0) s.erase(0);
    }
    if (l_new > l) {
      if (--s[v[l]] == 0) s.erase(v[l]);
    }
    if (r_new > r) {
      s[v[r_new]]++;
    }
    out = out_new;
    r = r_new;
    l = l_new;
    int mx_new = s.rbegin()->first;
    diff[i] += mx_new - mx;
    mx = mx_new;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> w;
  for (int i = 0; i < n; ++i) {
    a.push_back({});
    int l;
    cin >> l;
    for (int j = 0; j < l; ++j) {
      int t;
      cin >> t;
      a.back().push_back(t);
    }
  }
  for (int i = 0; i < n; ++i) {
    update_diff(a[i]);
  }
  long long v = 0;
  for (int i = 0; i < w; ++i) {
    v += diff[i];
    cout << v << ' ';
  }
}
