#include <bits/stdc++.h>
using namespace std;
template <class S, class T>
pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first + t.first, s.second + t.second);
}
template <class S, class T>
pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first - t.first, s.second - t.second);
}
template <class S, class T>
ostream &operator<<(ostream &os, pair<S, T> p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long inf = 1000000001;
const long long INF = (long long)1e18 + 1;
const long long MOD = 1000000007;
const double pi = 3.14159265358979323846;
int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
int dx2[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dy2[8] = {0, 1, 1, 1, 0, -1, -1, -1};
class LazySegmentTree {
 public:
  int n;
  vector<long long> node, lazy;
  LazySegmentTree(vector<long long> a) {
    int _n = a.size();
    n = 1;
    while (n < _n) n *= 2;
    node.resize(2 * n - 1);
    lazy.resize(2 * n - 1);
    for (int i = 0; i < _n; i++) node[i + n - 1] = a[i];
    for (int i = n - 2; i >= 0; i--) {
      node[i] = node[i * 2 + 1] + node[i * 2 + 2];
    }
  }
  inline void eval(int k, int l, int r) {
    if (lazy[k] != 0) {
      node[k] += (r - l) * lazy[k];
      if (r - l > 1) {
        lazy[2 * k + 1] += lazy[k];
        lazy[2 * k + 2] += lazy[k];
      }
      lazy[k] = 0;
    }
  }
  void add(int a, int b, long long x, int k, int l, int r) {
    eval(k, l, r);
    if (b <= l || r <= a) return;
    if (a <= l && r <= b) {
      lazy[k] += x;
      eval(k, l, r);
    } else {
      add(a, b, x, 2 * k + 1, l, (l + r) / 2);
      add(a, b, x, 2 * k + 2, (l + r) / 2, r);
      node[k] = node[2 * k + 1] + node[2 * k + 2];
    }
  }
  long long getsum(int a, int b, int k, int l, int r) {
    eval(k, l, r);
    if (b <= l || r <= a) return 0;
    if (a <= l && r <= b) return node[k];
    long long resl = getsum(a, b, 2 * k + 1, l, (l + r) / 2);
    long long resr = getsum(a, b, 2 * k + 2, (l + r) / 2, r);
    return resl + resr;
  }
};
vector<pair<int, int> > cover(vector<pair<int, int> > lrl,
                              pair<int, int> zero) {
  vector<pair<int, int> > res;
  for (int i = 0; i < (lrl.size()); i++) {
    pair<int, int> lr = lrl[i];
    if (lr.first >= zero.second) {
      res.push_back(lr);
    } else if (lr.second <= zero.first) {
      res.push_back(lr);
    } else if (zero.first <= lr.first and lr.second <= zero.second) {
      continue;
    } else if (lr.first <= zero.first and zero.second <= lr.second) {
      res.push_back(pair<int, int>(lr.first, zero.first));
      res.push_back(pair<int, int>(zero.second, lr.second));
    } else if ((zero.first <= lr.first && lr.first < zero.second)) {
      lr.first = zero.second;
      res.push_back(lr);
    }
    if ((zero.first <= lr.second && lr.second < zero.second)) {
      lr.second = zero.first;
      res.push_back(lr);
    }
  }
  return res;
}
vector<pair<int, int> > merge_lr(vector<pair<int, int> > lrl) {
  if (lrl.size() == 0) {
    return lrl;
  }
  sort(lrl.begin(), lrl.end());
  vector<pair<int, int> > res;
  for (int i = 0; i < (lrl.size()); i++) {
    pair<int, int> lr = lrl[i];
    if (res.size() == 0)
      res.push_back(lr);
    else {
      if (res.back().second >= lr.first) {
        chmax(res[res.size() - 1].second, lr.second);
      } else {
        res.push_back(lr);
      }
    }
  }
  return res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ;
  int q, w;
  cin >> q >> w;
  vector<long long> temp(w);
  LazySegmentTree lst(temp);
  using P = pair<long long, pair<int, int> >;
  priority_queue<P> pq;
  for (int i = 0; i < (q); i++) {
    int n;
    cin >> n;
    for (int j = 0; j < (n); j++) {
      long long x;
      cin >> x;
      pq.push(make_pair(x, pair<int, int>(j, j + w - n + 1)));
    }
    vector<pair<int, int> > zero;
    if (n <= w / 2) {
      zero.push_back(pair<int, int>(0, w));
    } else {
      zero.push_back(pair<int, int>(0, w - n));
      zero.push_back(pair<int, int>(n, w));
    }
    set<pair<int, int> > st;
    while (pq.size() > 0) {
      auto temp = pq.top();
      pq.pop();
      long long x = temp.first;
      pair<int, int> lr = temp.second;
      pair<int, int> lr2 = lr;
      auto itr = st.lower_bound(lr);
      while (itr != st.end()) {
        int nl = itr->first;
        if (nl >= lr2.second)
          break;
        else
          lr2.second = nl;
      }
      itr = st.lower_bound(lr);
      while (itr != st.begin()) {
        itr--;
        int pr = itr->second;
        if (pr <= lr2.first)
          break;
        else
          lr2.first = pr;
      }
      if (x < 0) {
        vector<pair<int, int> > lr3(1, lr2);
        for (int i = 0; i < (zero.size()); i++) {
          lr3 = cover(lr3, zero[i]);
        }
        lr3 = merge_lr(lr3);
        for (int i = 0; i < (lr3.size()); i++) {
          if (lr3[i].first < lr3[i].second) {
            lst.add(lr3[i].first, lr3[i].second, x, 0, 0, lst.n);
          }
        }
      } else {
        if (lr2.first < lr2.second) {
          lst.add(lr2.first, lr2.second, x, 0, 0, lst.n);
        }
      }
      st.insert(lr);
    }
  }
  for (int i = 0; i < (w); i++) {
    cout << lst.getsum(i, i + 1, 0, 0, lst.n) << " ";
  }
  cout << endl;
}
