#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
vector<int> a[N];
long long t[4 * N], o[4 * N];
int mx[4 * N];
inline void build(int v, int l, int r, int num) {
  if (l == r) {
    mx[v] = a[num][l];
  } else {
    int m = (r + l) >> 1;
    build(v + v + 1, l, m, num);
    build(v + v + 2, m + 1, r, num);
    mx[v] = max(mx[v + v + 1], mx[v + v + 2]);
  }
}
inline int findMax(int v, int l, int r, int tl, int tr) {
  if (tl > tr) return -1e9 - 1;
  if (l == tl && r == tr) {
    return mx[v];
  } else {
    int m = (r + l) >> 1;
    int t1 = findMax(v + v + 1, l, m, tl, min(m, tr));
    int t2 = findMax(v + v + 2, m + 1, r, max(m + 1, tl), tr);
    return max(t1, t2);
  }
}
inline void push(int v, int l, int r) {
  t[v] += o[v] * (r - l + 1);
  if (v + v + 2 < 4 * N) {
    o[v + v + 1] += o[v];
    o[v + v + 2] += o[v];
  }
  o[v] = 0;
}
inline void update(int v, int l, int r, int tl, int tr, int val) {
  push(v, l, r);
  if (tl > tr) return;
  if (tl == l && tr == r) {
    o[v] += val;
    push(v, l, r);
  } else {
    int m = (r + l) >> 1;
    update(v + v + 1, l, m, tl, min(m, tr), val);
    update(v + v + 2, m + 1, r, max(m + 1, tl), tr, val);
    t[v] = t[v + v + 1] + t[v + v + 2];
  }
}
inline long long get(int v, int l, int r, int pos) {
  push(v, l, r);
  if (l == r) {
    return t[v];
  } else {
    int m = (r + l) >> 1;
    if (pos <= m) {
      return get(v + v + 1, l, m, pos);
    } else {
      return get(v + v + 2, m + 1, r, pos);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    int sz;
    cin >> sz;
    for (int j = 0; j < sz; ++j) {
      int b;
      cin >> b;
      a[i].push_back(b);
    }
  }
  for (int i = 0; i < n; ++i) {
    int sz = a[i].size();
    build(0, 0, sz - 1, i);
    int mx_element = findMax(0, 0, sz - 1, 0, sz - 1);
    if (m - sz + 1 == sz)
      update(0, 0, m - 1, sz - 1, m - sz, mx_element);
    else
      update(0, 0, m - 1, sz - 1, m - sz, max(0, mx_element));
    int x = sz - 1, y = m - sz;
    if (m - sz < sz - 1) {
      x = sz, y = sz - 1;
    }
    for (int j = 0; j < x; ++j) {
      int r = j;
      int l = max(0, r - (m - sz));
      mx_element = findMax(0, 0, sz - 1, l, r);
      if (r - (m - sz) < 0) {
        mx_element = max(0, mx_element);
      }
      update(0, 0, m - 1, j, j, mx_element);
    }
    for (int j = y + 1; j < m; ++j) {
      int r = sz - 1;
      int l = max(0, r - (m - 1 - j));
      mx_element = max(findMax(0, 0, sz - 1, l, r), 0);
      update(0, 0, m - 1, j, j, mx_element);
    }
  }
  for (int i = 0; i < m; ++i) {
    cout << get(0, 0, m - 1, i) << ' ';
  }
}
