Problem: You are given n arrays that can have different sizes. You also have a table with w columns and n rows. The i-th array is placed horizontally in the i-th row. You can slide each array within its row as long as it occupies several consecutive cells and lies completely inside the table.

You need to find the maximum sum of the integers in the j-th column for each j from 1 to w independently.

<image> Optimal placements for columns 1, 2 and 3 are shown on the pictures from left to right.

Note that you can exclude any array out of a column provided it remains in the window. In this case its value is considered to be zero.

Input

The first line contains two integers n (1 ≤ n ≤ 10^{6}) and w (1 ≤ w ≤ 10^{6}) — the number of arrays and the width of the table.

Each of the next n lines consists of an integer l_{i} (1 ≤ l_{i} ≤ w), the length of the i-th array, followed by l_{i} integers a_{i1}, a_{i2}, …, a_{il_i} (-10^{9} ≤ a_{ij} ≤ 10^{9}) — the elements of the array.

The total length of the arrays does no exceed 10^{6}.

Output

Print w integers, the i-th of them should be the maximum sum for column i.

Examples

Input


3 3
3 2 4 8
2 2 5
2 6 3


Output


10 15 16 


Input


2 2
2 7 8
1 -8


Output


7 8 

Note

Illustration for the first example is in the statement.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
const long long md = 1e9 + 7;
const int Inf = 1e9;
const long long Inf64 = 1e18;
const long long MaxN = 3e5 + 10;
const long long LogN = 25;
const long long MaxM = 5e5 + 10;
const long double eps = 1e-7;
const long long dx[4] = {0, 1, 0, -1};
const long long dy[4] = {1, 0, -1, 0};
const long long ddx[4] = {1, 1, -1, -1};
const long long ddy[4] = {1, -1, 1, -1};
const long double Pi = acos(-1);
using namespace std;
template <typename T>
istream &operator>>(istream &in, pair<T, T> &a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T>
ostream &operator<<(ostream &out, pair<T, T> a) {
  out << a.first << ' ' << a.second;
  return out;
}
template <typename T>
istream &operator>>(istream &in, vector<T> &Mt) {
  for (T &a : Mt) in >> a;
  return in;
}
template <typename T>
ostream &operator<<(ostream &out, vector<T> Mt) {
  for (int i = 0; i < Mt.size(); i++) {
    out << Mt[i];
    if (i != Mt.size()) out << ' ';
  }
  out << '\n';
  return out;
}
inline long long Mod(long long &a, long long m = md) {
  while (a >= m) a -= m;
  return a;
}
inline long long gcd(long long a, long long b) {
  while (a) {
    b %= a;
    swap(a, b);
  }
  return b;
}
inline long long gcdex(long long a, long long mod = md) {
  long long g = mod, r = a, x = 0, y = 1;
  while (r != 0) {
    long long q = g / r;
    g %= r;
    swap(g, r);
    x -= q * y;
    swap(x, y);
  }
  return x < 0 ? x + mod : x;
}
inline long long binpow(long long a, long long n, long long m = md) {
  long long res = 1;
  while (n) {
    if (n & 1) {
      res *= a;
      res %= m;
    }
    a *= a;
    a %= m;
    n >>= 1;
  }
  return res % md;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed, cout.precision(20);
  {
    long long N, W;
    cin >> N >> W;
    vector<long long> Ans(W);
    vector<long long> Sv(W + 1);
    vector<long long> Mt;
    for (int i = 0; i < N; i++) {
      long long K;
      cin >> K;
      Mt.resize(K);
      cin >> Mt;
      long long Mx = *max_element(Mt.begin(), Mt.end());
      Mx = max(0ll, Mx);
      if (K == W) {
        for (int j = 0; j < W; j++) {
          Ans[j] += Mt[j];
        }
      } else if (K * 2 > W) {
        long long d = W - K;
        deque<pair<long long, long long> > St;
        St.push_back({-1, 0});
        Mt.push_back(0);
        K++;
        for (int j = 0; j < W; j++) {
          while (St.size() && St.front().first < j - d) St.pop_front();
          if (j < K) {
            while (St.size() && St.back().second <= Mt[j]) St.pop_back();
            St.push_back({j, Mt[j]});
          }
          Ans[j] += St.front().second;
        }
      } else {
        Sv[K] += Mx;
        Sv[W - K] -= Mx;
        long long M = 0;
        for (int j = 0; j < K; j++) {
          M = max(M, Mt[j]);
          Ans[j] += M;
        }
        M = 0;
        for (int j = 0; j < K; j++) {
          M = max(M, Mt[K - j - 1]);
          Ans[W - 1 - j] += M;
        }
      }
    }
    for (int i = 1; i < W; i++) Sv[i] += Sv[i - 1], Ans[i] += Sv[i];
    Ans[0] += Sv[0];
    cout << Ans;
  }
END:
  return 0;
}