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;
template <class T, class Compare = less<int> >
struct segment_tree {
 private:
  struct node {
    T val;
    int left_id, right_id;
    node *l, *r;
  };

 public:
  T mod = 0;
  segment_tree() {}
  segment_tree(T m) { mod = m; }
  node *root;
  node *build(int left, int right, vector<T> &a, int x) {
    node *res = new node;
    res->left_id = left;
    res->right_id = right;
    if (left == right) {
      res->l = res->r = nullptr;
      res->val = a[left];
    } else {
      int mid = (left + right) >> 1;
      res->l = build(left, mid, a);
      res->r = build(mid + 1, right, a);
      T ans = Compare()(res->l->val, res->r->val);
      if (mod) ans %= mod;
      res->val = ans;
    }
    return res;
  }
  T query(node *Node, int left, int right) {
    if (right < Node->left_id || left > Node->right_id) return Compare()();
    if (left <= Node->left_id && right >= Node->right_id) return Node->val;
    T res_1 = query(Node->l, left, right);
    T res_2 = query(Node->r, left, right);
    T ans = Compare()(res_1, res_2);
    if (mod) ans %= mod;
    return ans;
  }
  void update(node *Node, int pos, int new_val) {
    if (pos > Node->right_id || pos < Node->left_id) return;
    if (Node->left_id == Node->right_id)
      Node->val = new_val;
    else {
      update(Node->l, pos, new_val);
      update(Node->r, pos, new_val);
      T ans = Compare()(Node->l->val, Node->r->val);
      if (mod) ans %= mod;
      Node->val = ans;
    }
  }
  node *build(int left, int right, vector<T> &a) {
    return root = build(left, right, a, 1);
  }
  void update(int pos, int new_val) { update(root, pos, new_val); }
  T query(int left, int right) { return query(root, left, right); }
  struct max {
    T operator()(const T &a, const T &b) const { return a > b ? a : b; }
    T operator()() { return -1e9; }
  };
  struct min {
    T operator()(const T &a, const T &b) const { return a < b ? a : b; }
    T operator()() { return 1e9; }
  };
  struct gcd {
    T operator()(const T &a, const T &b) const { return __gcd(a, b); }
    T operator()() { return 1; }
  };
  struct sum {
    T operator()(const T &a, const T &b) { return a + b; }
    T operator()() { return 0; }
  };
  struct mul {
    T operator()(const T &a, const T &b) { return a * b; }
    T operator()() { return 1; }
  };
};
long long a[1 << 20], ans[1 << 20];
int main() {
  srand(time(0));
  int n, w;
  ios::sync_with_stdio(0);
  cin >> n >> w;
  for (int i = 1; i <= n; i++) {
    int k;
    cin >> k;
    vector<int> v;
    v.push_back(0);
    for (int i = 1; i <= k; i++) {
      int x;
      cin >> x;
      v.push_back(x);
    }
    segment_tree<int, segment_tree<int>::max> sg;
    sg.build(1, k, v);
    for (int i = 1; i <= k; i++) {
      int x = sg.query(i - min(i - 1, w - k), i);
      if (i > k || i + k <= w) x = max(x, 0);
      a[i] += x;
      a[i + 1] -= x;
    }
    v.push_back(0);
    reverse(v.begin(), v.end());
    segment_tree<int, segment_tree<int>::max> sg1;
    sg1.build(1, k, v);
    for (int i = 1; i <= min(w - k, k); i++) {
      int x = sg1.query(i - min(i - 1, w - k), i);
      if (i > k || i + k <= w) x = max(x, 0);
      a[w - i + 1] += x;
      a[w - i + 2] -= x;
    }
    if (k + k < w) {
      int mx = sg.query(1, k);
      if (mx > 0) {
        a[k + 1] += mx;
        a[w - k + 1] -= mx;
      } else {
        int l1 = 1;
        int r1 = w - k - 1;
        int l2 = k + 1;
        int r2 = w;
        int l = r1 + 1;
        int r = l2 - 1;
        if (r >= l) {
          a[l] += mx;
          a[r + 1] -= mx;
        }
      }
    }
  }
  for (int i = 1; i <= w; i++) {
    a[i] += a[i - 1];
    cout << a[i] << " ";
  }
}