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 = 0x3f3f3f3f;
const double eps = 1e-6;
const long long mod = 1000000007;
inline string getstr(string &s, long long l, long long r) {
  string ret = "";
  for (long long i = l; i <= r; i++) ret.push_back(s[i]);
  return ret;
}
long long modpow(long long x, long long y, long long md = mod) {
  if (y == 0) return 1;
  long long ret = modpow(x, y >> 1, md);
  ret = (long long)ret * ret % md;
  if (y & 1) ret = (long long)ret * x % md;
  return ret;
}
long long n, w;
long long ans[1000005];
long long len, a[1000005], pref[1000005], suf[1000005];
void range_add(long long l, long long r, long long v) {
  ans[l] += v;
  ans[r + 1] -= v;
}
long long f[1048576 << 1];
void Set(long long x, long long v) {
  x += 1048576;
  f[x] = v;
  while (x != 1) {
    x >>= 1;
    f[x] = max(f[x << 1], f[x << 1 | 1]);
  }
}
long long l, r;
long long get_Max(long long L, long long R, long long k) {
  if (l <= L && R <= r) return f[k];
  if (R < l || r < L) return -inf;
  return max(get_Max(L, L + R >> 1, k << 1),
             get_Max((L + R >> 1) + 1, R, k << 1 | 1));
}
long long get_max(long long L, long long R) {
  l = L;
  r = R;
  return get_Max(0, 1048576 - 1, 1);
}
void solve() {
  scanf("%I64d", &len);
  for (long long i = 1; i <= len; i++) scanf("%I64d", &a[i]), Set(i, a[i]);
  if (len == w) {
    for (long long i = 1; i <= w; i++) range_add(i, i, a[i]);
    return;
  }
  pref[0] = -inf;
  for (long long i = 1; i <= len; i++) {
    pref[i] = max(pref[i - 1], a[i]);
  }
  suf[len + 1] = -inf;
  for (long long i = len; i >= 1; i--) {
    suf[i] = max(suf[i + 1], a[i]);
  }
  if (len * 2 >= w) {
    for (long long i = 1; i <= w; i++) {
      long long v = get_max(max(1ll, i - w + len), min(i, len));
      if (i + len <= w || i > len) v = max(v, 0ll);
      range_add(i, i, v);
    }
  } else {
    for (long long i = 1; i <= len; i++) range_add(i, i, max(0ll, pref[i]));
    for (long long i = w; i > w - len; i--) {
      range_add(i, i, max(0ll, suf[i - w + len]));
    }
    range_add(len + 1, w - len, max(0ll, pref[len]));
  }
}
signed main() {
  scanf("%I64d%I64d", &n, &w);
  for (long long i = 1; i <= n; i++) {
    solve();
  }
  for (long long i = 2; i <= w; i++) ans[i] += ans[i - 1];
  for (long long i = 1; i <= w; i++) printf("%I64d ", ans[i]);
  return 0;
}