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;
int n, w;
vector<vector<int>> a;
long long diff[1000000];
void update_diff(vector<int> &v) {
  map<int, int> s;
  if (v.size() < w) s[0] = 1;
  s[v[0]]++;
  int mx = s.rbegin()->first;
  diff[0] += mx;
  bool out = v.size() < w;
  int l = 0;
  int r = 0;
  for (int i = 0; i < w; ++i) {
    if (i > v.size() + 3 && i + v.size() + 3 < w) {
      i = w - v.size() - 3;
      continue;
    }
    bool out_new = false;
    int l_new = i - (w - v.size());
    if (l_new < 0) {
      l_new = 0;
      out_new = true;
    }
    int r_new = i;
    if (r_new >= v.size()) {
      r_new = v.size() - 1;
      out_new = true;
    }
    if (out_new && !out) s[0]++;
    if (!out_new && out) {
      if (--s[0] == 0) s.erase(0);
    }
    if (l_new > l) {
      if (--s[v[l]] == 0) s.erase(v[l]);
    }
    if (r_new > r) {
      s[v[r_new]]++;
    }
    out = out_new;
    r = r_new;
    l = l_new;
    int mx_new = s.rbegin()->first;
    diff[i] += mx_new - mx;
    mx = mx_new;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> w;
  for (int i = 0; i < n; ++i) {
    a.push_back({});
    int l;
    cin >> l;
    for (int j = 0; j < l; ++j) {
      int t;
      cin >> t;
      a.back().push_back(t);
    }
  }
  for (int i = 0; i < n; ++i) {
    update_diff(a[i]);
  }
  long long v = 0;
  for (int i = 0; i < w; ++i) {
    v += diff[i];
    cout << v << ' ';
  }
}