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 int N = 1e6 + 5;
const int INF = 0x3f3f3f3f;
int n, w, a[N];
long long an[N];
struct max_tree {
  int l, r, mxx;
} tr[N << 2];
void build(int l, int r, int rt) {
  tr[rt].l = l, tr[rt].r = r, tr[rt].mxx = -INF;
  if (l == r) {
    tr[rt].mxx = a[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, rt << 1);
  build(mid + 1, r, rt << 1 | 1);
  tr[rt].mxx = max(tr[rt << 1].mxx, tr[rt << 1 | 1].mxx);
}
int query(int ql, int qr, int rt) {
  int l = tr[rt].l, r = tr[rt].r;
  if (ql <= l and r <= qr) {
    return tr[rt].mxx;
  }
  int mid = (l + r) >> 1, ans = -INF;
  if (ql <= mid) ans = max(ans, query(ql, qr, rt << 1));
  if (qr > mid) ans = max(ans, query(ql, qr, rt << 1 | 1));
  return ans;
}
struct ans_tree {
  int l, r;
  long long sum;
} ans[N << 2];
void init(int l, int r, int rt) {
  ans[rt].l = l, ans[rt].r = r;
  ans[rt].sum = 0;
  if (l == r) return;
  int mid = (l + r) >> 1;
  init(l, mid, rt << 1);
  init(mid + 1, r, rt << 1 | 1);
}
void update(int ql, int qr, long long v, int rt) {
  int l = ans[rt].l, r = ans[rt].r;
  if (ql <= l and r <= qr) {
    ans[rt].sum += v;
    return;
  }
  int mid = (l + r) >> 1;
  if (ql <= mid) update(ql, qr, v, rt << 1);
  if (qr > mid) update(ql, qr, v, rt << 1 | 1);
}
void push_down(int rt, long long sum) {
  long long now = sum + ans[rt].sum;
  int l = ans[rt].l, r = ans[rt].r;
  if (l == r) {
    an[l] = now;
    return;
  }
  push_down(rt << 1, now);
  push_down(rt << 1 | 1, now);
}
void main_solve() {
  cin >> n >> w;
  init(1, w, 1);
  for (int i = 1; i <= n; ++i) {
    int m;
    cin >> m;
    for (int j = 1; j <= m; ++j) cin >> a[j];
    build(1, m, 1);
    int dx = (w - m);
    for (int l = 1, r; l <= w; l = r + 1) {
      r = l;
      int s = max(1, l - dx), e = min(l, m);
      int v = query(s, e, 1);
      if (l - dx <= 0 or m < r) v = max(0, v);
      if (l - dx <= 1 and m <= r) r = max(r, dx);
      update(l, r, 1LL * v, 1);
    }
  }
  push_down(1, 0LL);
  for (int i = 1; i <= w; ++i) cout << an[i] << ' ';
  cout << '\n';
  return;
}
signed main() {
  iostream::sync_with_stdio(false);
  int T = 1;
  while (T--) main_solve();
  return 0;
}