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 MAX = 1e6 + 5;
class ST_MAX {
 public:
  vector<vector<int> > dat;
  int mxlog, n;
  ST_MAX() {}
  void start(int N) {
    n = N;
    mxlog = 32 - __builtin_clz(N);
    dat.resize(mxlog);
    for (int i = 0; i < (mxlog); i++) dat[i].resize(N);
  }
  void set(int p, int v) { dat[0][p] = v; }
  void init() {
    for (int lg = 0; lg < (mxlog - 1); lg++)
      for (int i = 0; i < (n); i++)
        if (i + (1 << lg) < n)
          dat[lg + 1][i] = max(dat[lg][i], dat[lg][i + (1 << lg)]);
        else
          dat[lg + 1][i] = dat[lg][i];
  }
  int get(int l, int r) const {
    r++;
    if (r - l == 0) return 0;
    int id = 31 - __builtin_clz(r - l);
    if (id < 0) return 0;
    return max(dat[id][l], dat[id][r - (1 << id)]);
  }
} st;
int T, W, N, a[MAX];
long long ret[MAX];
int main() {
  scanf("%d%d", &T, &W);
  while (T--) {
    scanf("%d", &N);
    st.start(N);
    for (int i = 0; i < (N); i++) {
      scanf("%d", &a[i]);
      st.set(i, a[i]);
    }
    st.init();
    for (int i = 0; i < W; i++) {
      int lpos = max(i - (W - N), 0), rpos = min(i, N - 1);
      int cur = st.get(lpos, rpos);
      if (cur < 0 && (i >= N || i < W - N)) cur = 0;
      ret[i] += cur;
      if (lpos == 0 && rpos == N - 1 && i >= N && W >= 2 * N + 1)
        i = max(i, W - N - 1);
      ret[i + 1] -= cur;
    }
  }
  for (int i = 0; i < (W); i++) ret[i + 1] += ret[i];
  for (int i = 0; i < (W); i++) printf("%I64d ", ret[i]);
  puts("");
  return 0;
}