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 JAVA):

Solution:
import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class Main {

    public static long[] add;

    public static class Pair implements Comparable<Pair> {

        int ind;
        int val;

        public Pair(int v, int i) {
            this.val = v;
            this.ind = i;
        }

        @Override
        public int compareTo(Pair o) {
            if (this.val == o.val) {
                return this.ind - o.ind;
            } else {
                return this.val - o.val;
            }
        }
    }

    public static void toAdd(int v, int vl, int vr, int ql, int qr, int x) {
        if (ql <= vl && vr <= qr) {
            add[v] += x;
            return;
        } else if (vl >= qr || ql >= vr) {
            return;
        }
        toAdd(v * 2, vl, (vr + vl) / 2, ql, qr, x);
        toAdd(v * 2 + 1, (vr + vl) / 2, vr, ql, qr, x);
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(scan.readLine());
        int n = Integer.parseInt(st.nextToken());
        int w = Integer.parseInt(st.nextToken());
        int newW = w;
        int counter = 0;
        while (newW > 0) {
            ++counter;
            newW /= 2;
        }
        newW = 1 << counter;
        
        
        long[] ans = new long[w];
        add = new long[newW * 2];
        TreeSet<Pair> set = new TreeSet<>();
        
        
        for (int t = 0; t < n; ++t) {
            st = new StringTokenizer(scan.readLine());
            int len = Integer.parseInt(st.nextToken());
            int[] array = new int[len];
            for (int i = 0; i < len; ++i) {
                array[i] = Integer.parseInt(st.nextToken());
            }
            int sdv = Math.min(w - len, len);
            set.clear();
            for (int i = 0; i < w; ++i) {
                if (i < len) {
                    set.add(new Pair(array[i], i));
                    if (i - sdv - 1 >= 0) {
                        set.remove(new Pair(array[i - sdv - 1], i - sdv - 1));
                    }
                } else if (i + sdv >= w) {
                    if (len - 1 - sdv >= 0) {
                        set.remove(new Pair(array[len - 1 - sdv], len - 1 - sdv));
                    }
                    --sdv;
                } else {
                    toAdd(1, 0, newW, i, w - len, Math.max(set.last().val, 0));
                    i = w - len - 1;
                    continue;
                }
                if (i >= len || len + i < w) {
                    ans[i] += Math.max(set.last().val, 0);
                } else {
                    ans[i] += set.last().val;
                }
            }
        }
        
        for (int i = 0; i < newW; ++i) {
            add[i * 2] += add[i];
            add[i * 2 + 1] += add[i];
            add[i] = 0;
        }
        
        for (int i = newW; i < newW + w; ++i) {
            ans[i - newW] += add[i];
        }
        
        StringBuilder strAns = new StringBuilder();
        for (int i = 0; i < w; ++i) {
            strAns.append(ans[i]);
            strAns.append(' ');
        }
        out.print(strAns);
        out.close();
    }
}