#include <bits/stdc++.h>
using namespace std;
long long sum[1000006], add[1000006];
int Q[1000006], A[1000006];
int main() {
  int n, m, a;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a);
    A[a + 1] = 0;
    int head = 1, tail = 0, mx = 0;
    for (int j = 1; j <= a; j++) scanf("%d", &A[j]), mx = max(mx, A[j]);
    Q[++tail] = 0;
    for (int j = 1; j <= a; j++) {
      while (tail >= head && A[j] > A[Q[tail]]) tail--;
      Q[++tail] = j;
      while (head <= tail && j + a - Q[head] > m) head++;
      sum[j] += A[Q[head]];
    }
    int len = a;
    head = tail = 1;
    Q[1] = a + 1;
    for (int j = m; j >= max(m - a + 1, a + 1); j--) {
      while (tail >= head && A[len] > A[Q[tail]]) tail--;
      Q[++tail] = len--;
      while (head <= tail && j - Q[head] < 0) head++;
      sum[j] += A[Q[head]];
    }
    if (a * 2 < m) add[a + 1] += mx, add[m - a + 1] -= mx;
  }
  for (int i = 1; i <= m; i++)
    add[i] += add[i - 1], sum[i] += add[i], printf("%lld ", sum[i]);
  return 0;
}
