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 maxn = 1e6 + 10;
void in(long long &x) {
  long long y = 1;
  char c = getchar();
  x = 0;
  while (c < '0' || c > '9') {
    if (c == '-') y = -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  x *= y;
}
long long read() {
  long long x;
  long long y = 1;
  char c = getchar();
  x = 0;
  while (c < '0' || c > '9') {
    if (c == '-') y = -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  x *= y;
  return x;
}
void o(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) o(x / 10);
  putchar(x % 10 + '0');
}
struct linetree {
  long long sum[maxn * 4], lazy[maxn * 4];
  long long a[maxn];
  void PushUp(long long rt) { sum[rt] = sum[rt << 1] + sum[rt << 1 | 1]; }
  void PushDown(long long rt, long long ln, long long rn) {
    if (lazy[rt]) {
      lazy[rt << 1] += lazy[rt];
      lazy[rt << 1 | 1] += lazy[rt];
      sum[rt << 1] += lazy[rt] * ln;
      sum[rt << 1 | 1] += lazy[rt] * rn;
      lazy[rt] = 0;
    }
  }
  void Build(long long l, long long r, long long rt) {
    if (l == r) {
      sum[rt] = a[l];
      return;
    }
    long long m = (l + r) >> 1;
    Build(l, m, rt << 1);
    Build(m + 1, r, rt << 1 | 1);
    PushUp(rt);
  }
  void Update(long long L, long long R, long long C, long long l, long long r,
              long long rt) {
    if (L <= l && r <= R) {
      sum[rt] += C * (r - l + 1);
      lazy[rt] += C;
      return;
    }
    long long m = (l + r) >> 1;
    PushDown(rt, m - l + 1, r - m);
    if (L <= m) Update(L, R, C, l, m, rt << 1);
    if (R > m) Update(L, R, C, m + 1, r, rt << 1 | 1);
    PushUp(rt);
  }
  long long Query(long long L, long long R, long long l, long long r,
                  long long rt) {
    if (L <= l && r <= R) {
      return sum[rt];
    }
    long long m = (l + r) >> 1;
    PushDown(rt, m - l + 1, r - m);
    long long ANS = 0;
    if (L <= m) ANS += Query(L, R, l, m, rt << 1);
    if (R > m) ANS += Query(L, R, m + 1, r, rt << 1 | 1);
    return ANS;
  }
} tre;
long long n, w;
long long lenth;
vector<long long> g;
deque<long long> num, id;
void get() {
  num.clear(), id.clear();
  for (long long i = 1; i <= w; i++) {
    if (i < g.size()) {
      while (!num.empty() && num.back() < g[i]) {
        num.pop_back();
        id.pop_back();
      }
      num.push_back(g[i]);
      id.push_back(i);
    } else if (w - i + 1 > lenth) {
      if (num.front() > 0) tre.Update(i, w - i + 1, num.front(), 1, w, 1);
      i = w - lenth;
      continue;
    }
    if (lenth - id.front() > w - i) {
      num.pop_front();
      id.pop_front();
    }
    if (num.front() < 0 && (i <= w - lenth || w - i + 1 <= w - lenth)) continue;
    tre.Update(i, i, num.front(), 1, w, 1);
  }
}
signed main() {
  in(n);
  in(w);
  for (long long i = 1; i <= n; i++) {
    in(lenth);
    g.clear();
    g.push_back(0);
    for (long long j = 1; j <= lenth; j++) g.push_back(read());
    get();
  }
  for (long long i = 1; i <= w; i++) {
    o(tre.Query(i, i, 1, w, 1));
    putchar(' ');
  }
  putchar('\n');
  return 0;
}