#include <bits/stdc++.h>
using namespace std;
struct max_queue {
  multiset<int> m;
  int find_max() {
    if (!((int)(m).size())) return 0;
    return *m.rbegin();
  }
  void push(int x) { m.insert(x); }
  void pop(int x) { m.erase(m.find(x)); }
};
const int N = 1000005;
long long n, w, res[N];
vector<pair<int, int> > add[N], take[N];
max_queue g[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> w;
  for (int i = 0, ggd = n; i < ggd; i++) {
    int x;
    cin >> x;
    int sz = w - x;
    if (sz) {
      add[0].push_back({0, i});
      take[w - x].push_back({0, i});
    }
    for (int j = 0, ggd = x; j < ggd; j++) {
      long long y;
      cin >> y;
      add[j].push_back({y, i});
      take[j + sz + 1].push_back({y, i});
    }
    if (sz) {
      add[x].push_back({0, i});
      take[w].push_back({0, i});
    }
  }
  long long cur = 0;
  for (int i = 0, ggd = w; i < ggd; i++) {
    for (auto it : add[i]) {
      int prev = g[it.second].find_max();
      cur -= prev;
      g[it.second].push(it.first);
      cur += g[it.second].find_max();
    }
    for (auto it : take[i]) {
      int prev = g[it.second].find_max();
      cur -= prev;
      g[it.second].pop(it.first);
      cur += g[it.second].find_max();
    }
    res[i] = cur;
  }
  for (int i = 0, ggd = w; i < ggd; i++) cout << res[i] << " ";
  cout << endl;
}
