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>
using namespace std;
const long long inf = 1e9 + 100;
const long long maxn = 1048576;
long long N, W;
long long n[maxn], m[maxn];
long long mx[maxn];
long long nn;
long long a[maxn];
long long l[maxn], r[maxn];
long long M[maxn * 2];
long long I[maxn];
long long p[maxn];
bool cmp(long long i, long long j) { return n[i] < n[j]; }
void make(long long nod, long long ls, long long rs) {
  if (rs - ls == 1) {
    M[nod] = a[ls];
    return;
  }
  make((nod * 2 + 1), ls, ((ls + rs) >> 1));
  make((nod * 2 + 2), ((ls + rs) >> 1), rs);
  M[nod] = max(M[(nod * 2 + 1)], M[(nod * 2 + 2)]);
}
long long fnd(long long nod, long long ls, long long rs, long long l,
              long long r) {
  if (rs <= l or r <= ls) return -inf;
  if (l <= ls and rs <= r) return M[nod];
  return max(fnd((nod * 2 + 1), ls, ((ls + rs) >> 1), l, r),
             fnd((nod * 2 + 2), ((ls + rs) >> 1), rs, l, r));
}
long long get(long long i, long long l, long long r) {
  return fnd(0, 0, nn, ::l[i] + l, ::l[i] + r);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> W;
  for (long long i = 0; i < N; i++) {
    cin >> n[i];
    m[i] = n[i];
    l[i] = nn;
    nn += n[i];
    r[i] = nn;
    for (long long j = l[i]; j < r[i]; j++) {
      cin >> a[j];
      mx[i] = max(mx[i], a[j]);
    }
    I[i] = i;
  }
  make(0, 0, nn);
  sort(I, I + N, cmp);
  sort(m, m + N);
  for (long long i = 0; i < N; i++) p[i + 1] += p[i] + mx[I[i]];
  for (long long i = 0; i < W; i++) {
    long long ans = 0;
    long long d = min(i + 1, W - i);
    long long D = max(i + 1, W - i);
    long long j = lower_bound(m, m + N, d) - m;
    ans += p[j];
    for (long long k = j; k < N; k++) {
      long long K = I[k];
      long long c = get(K, max(0ll, n[K] - (W - i)), min(n[K], i + 1));
      if (n[K] < D) c = max(c, 0ll);
      ans += c;
    }
    cout << ans << " ";
  }
  cout << endl;
  return 0;
}