#include <bits/stdc++.h>
using namespace std;
long long t[4000000];
long long t1[4000000];
long long t2[4000000];
long long lz[4000000];
long long ans[4000000];
long long dis[4000000];
long long p[4000000];
long long dp[708 + 5][708 + 5];
vector<pair<long long, long long> > v;
vector<int> v1;
long long n, m, k, l, r, nb, q;
set<pair<long long, long long> > st;
map<int, int> mapp;
map<int, int> mapp2;
map<pair<long long, long long>, int> mapp3;
void update(int node, int l1, int r1, int l, int r, long long val) {
  if ((l1 > r) || (r1 < l)) return;
  if ((l <= l1) && (r1 <= r)) {
    lz[node] += val;
    return;
  }
  int mid = (l1 + r1) / 2;
  update(2 * node, l1, mid, l, r, val);
  update(2 * node + 1, mid + 1, r1, l, r, val);
}
void debugst() {
  cout << "debugging st \n";
  set<pair<long long, long long> >::iterator it;
  for (it = st.begin(); it != st.end(); it++)
    cout << it->first << "," << it->second << '\n';
  cout << '\n';
}
void debugt() {
  cout << "debug t \n";
  for (int i = 0; i < m; i++) cout << t[i] << " ";
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  nb = m - 1;
  int cnt = 0;
  while (nb) nb >>= 1, cnt++;
  nb = (1 << cnt);
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    for (int i = 0; i < a; i++) cin >> t[i];
    if (a > m / 2) {
      t1[m - 1] = t[a - 1];
      st.clear();
      for (int i = 0; i < a; i++) {
        st.insert(make_pair(t[i], i));
        t1[i] = (st.rbegin())->first;
        if (i >= m - a) st.erase(make_pair(t[i - (m - a)], i - m + a));
      }
      for (int i = a; i < m - 1; i++) {
        t1[i] = (st.rbegin())->first;
        st.erase(make_pair(t[i - (m - a)], i - m + a));
      }
      for (int i = 0; i < m - a; i++) t1[i] = max(t1[i], 0ll);
      for (int i = a; i < m; i++) t1[i] = max(t1[i], 0ll);
      for (int i = 0; i < m; i++) ans[i] += t1[i];
    } else {
      long long maax = 0;
      for (int i = 0; i < a; i++) {
        maax = max(maax, t[i]);
        ans[i] += maax;
      }
      maax = 0;
      for (int i = m - 1; i > m - 1 - a; i--) {
        maax = max(maax, t[i - (m - a)]);
        ans[i] += maax;
      }
      update(1, 0, nb - 1, a, m - 1 - a, maax);
    }
  }
  for (int i = 1; i <= nb; i++) {
    lz[2 * i] += lz[i];
    lz[2 * i + 1] += lz[i];
  }
  for (int i = 0; i < m; i++) cout << lz[nb + i] + ans[i] << " ";
}
