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 LEN = 100000;
struct fastio {
  int it, len;
  char s[LEN + 5];
  fastio() { it = len = 0; }
  char get() {
    if (it < len) return s[it++];
    it = 0, len = fread(s, 1, LEN, stdin);
    return len ? s[it++] : EOF;
  }
  bool notend() {
    char c;
    for (c = get(); c == ' ' || c == '\n'; c = get())
      ;
    if (it) it--;
    return c != EOF;
  }
  void put(char c) {
    if (it == LEN) fwrite(s, 1, LEN, stdout), it = 0;
    s[it++] = c;
  }
  void flush() { fwrite(s, 1, it, stdout); }
} buff, bufo;
inline int getint() {
  char c;
  int res = 0, sig = 1;
  for (c = buff.get(); c < '0' || c > '9'; c = buff.get())
    if (c == '-') sig = -1;
  for (; c >= '0' && c <= '9'; c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline long long getll() {
  char c;
  long long res = 0, sig = 1;
  for (c = buff.get(); c < '0' || c > '9'; c = buff.get())
    if (c == '-') sig = -1;
  for (; c >= '0' && c <= '9'; c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
const int inf = 0x3f3f3f3f;
int n, w;
long long s[1000005];
void range_add(int l, int r, long long x) {
  s[l] += x;
  if (r < w) s[r + 1] -= x;
}
int a[1000005], deq[1000005], he, ta;
int main() {
  scanf("%d%d", &n, &w);
  for (int ii = 1; ii <= n; ii++) {
    int l;
    scanf("%d", &l);
    for (int i = 1; i <= l; i++) scanf("%d", &a[i]);
    int len = w - l + 1;
    if (len <= l) {
      he = ta = 0;
      for (int i = 1; i <= l; i++) {
        while (he < ta && deq[he] <= i - len) he++;
        while (he < ta && a[deq[ta - 1]] <= a[i]) ta--;
        deq[ta++] = i;
        if (i < len)
          range_add(i, i, max(0, a[deq[he]]));
        else
          range_add(i, i, a[deq[he]]);
      }
      long long maxi = 0;
      for (int i = w; i > l; i--) {
        maxi = max(maxi, (long long)a[i - len + 1]);
        range_add(i, i, maxi);
      }
    } else {
      long long maxi = 0;
      for (int i = 1; i < l; i++) {
        maxi = max(maxi, (long long)a[i]);
        range_add(i, i, maxi);
      }
      maxi = max(maxi, (long long)a[l]);
      range_add(l, len, maxi);
      maxi = 0;
      for (int i = w; i > len; i--) {
        maxi = max(maxi, (long long)a[i - len + 1]);
        range_add(i, i, maxi);
      }
    }
  }
  for (int i = 1; i <= w; i++) {
    s[i] += s[i - 1];
    printf("%I64d%c", s[i], i == w ? '\n' : ' ');
  }
  return 0;
}