#include <bits/stdc++.h>
const int N = 1e6 + 10;
const int mod = 998244353;
using namespace std;
int n, w, k, a[N], r[N], st[N];
long long ans[N];
void work() {
  int t = 0;
  for (int i = k; i >= 1; --i) {
    while (t > 0 && a[i] > a[st[t]]) t--;
    r[i] = (t == 0 ? w + 1 : st[t]);
    st[++t] = i;
  }
  int now = 1;
  for (int i = 1; i <= k; ++i) {
    int R = min(r[i] - 1, w - (k - i));
    int L = max(i, now);
    if (R >= L) {
      if (a[i] >= 0) {
        ans[L] += a[i];
        ans[R + 1] -= a[i];
      } else if (w - k + 1 <= k) {
        int tl = max(L, w - k + 1), tr = min(R, k);
        if (tr >= tl) {
          ans[tl] += a[i];
          ans[tr + 1] -= a[i];
        }
      }
      now = R + 1;
    }
  }
}
int main() {
  scanf("%d%d", &n, &w);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &k);
    for (int j = 1; j <= k; ++j) scanf("%d", &a[j]);
    work();
  }
  for (int i = 1; i <= w; ++i) ans[i] += ans[i - 1], printf("%lld ", ans[i]);
  return 0;
}
