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 P = 1e9 + 7, INF = 0x3f3f3f3f;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(long long a, long long n) {
  long long r = 1 % P;
  for (a %= P; n; a = a * a % P, n >>= 1)
    if (n & 1) r = r * a % P;
  return r;
}
long long inv(long long first) {
  return first <= 1 ? 1 : inv(P % first) * (P - P / first) % P;
}
char buf[1 << 23], *p1 = buf, *p2 = buf, obuf[1 << 23], *O = obuf;
inline int rd() {
  int t;
  scanf("%d", &t);
  return t;
  int first = 0, f = 1;
  char ch =
      (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
           ? EOF
           : *p1++);
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch =
        (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
             ? EOF
             : *p1++);
  }
  while (isdigit(ch))
    first = first * 10 + (ch ^ 48),
    ch =
        (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
             ? EOF
             : *p1++);
  return first * f;
}
const int N = 1e6 + 50;
int n, w;
int len[N], a[N], Log[N], f[21][N];
inline void init(int *a, int n) {
  for (int i = 1; i <= n; ++i) f[0][i] = a[i];
  for (int j = 1; j <= 20; ++j)
    for (int i = 0; i + (1 << j - 1) - 1 <= n; ++i) {
      f[j][i] = max(f[j - 1][i], f[j - 1][i + (1 << j - 1)]);
    }
}
inline int RMQ(int l, int r) {
  if (l > r) throw;
  int t = Log[r - l + 1];
  return max(f[t][l], f[t][r - (1 << t) + 1]);
}
long long ans[N], d[N];
void add(int l, int r, long long v) {
  if (l > r) return;
  d[l] += v, d[r + 1] -= v;
}
int main() {
  Log[0] = -1;
  for (int i = 1; i <= N - 1; ++i) Log[i] = Log[i >> 1] + 1;
  n = rd(), w = rd();
  for (int i = 1; i <= n; ++i) {
    int k = rd();
    for (int i = 1; i <= k; ++i) a[i] = rd();
    init(a, k);
    for (int i = 1; i <= k; ++i) {
      if (i < w - k + 1)
        ans[i] += max(0, RMQ(1, i));
      else
        ans[i] += RMQ(i - w + k, i);
    }
    int t = max(0, RMQ(1, k));
    add(k + 1, w - k + 1, t);
    for (int i = max(k + 1, w - k + 1 + 1); i <= w; ++i) {
      int R = k, L = w - k + 1;
      ans[i] += max(0, RMQ(i + k - w, k));
    }
  }
  long long ss = 0;
  for (int i = 1; i <= w; ++i) {
    ss += d[i];
    printf("%lld ", ans[i] + ss);
  }
  putchar(10);
}