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.*;

public class F {
    public static class pare implements Comparable<pare>{
        int ind;
        int val;
        public pare(int v, int i){
            this.val = v;
            this.ind = i;
        }
        @Override
        public int compareTo(pare o) {
            if(this.val == o.val){
                return this.ind - o.ind;
            }
            else{
                return this.val - o.val;
            }
        }
    }
    public static void to_add(int v, int vl, int vr, int ql, int qr, int x){
        if(ql <= vl && vr <= qr){
            add[v] += x;
        }
        else if(vl >= qr || ql >= vr){
            return;
        }
        else{
            to_add(v * 2, vl, (vr + vl) / 2, ql, qr, x);
            to_add(v * 2 + 1, (vr + vl) / 2, vr, ql, qr, x);
        }
    }
    public static long[] add;
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(reader.readLine());
        int n = Integer.parseInt(st.nextToken());
        int w = Integer.parseInt(st.nextToken());
        int new_w = w;
        int counter = 0;
        while(new_w > 0){
            ++counter;
            new_w /= 2;
        }
        new_w = 1 << counter;
        long[] ans = new long[w];
        add = new long[new_w * 2];
        TreeSet<pare> treeSet = new TreeSet<>();
        for(int t = 0; t < n; ++t){
            st = new StringTokenizer(reader.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);
            treeSet.clear();
            for(int i = 0; i < w; ++i){
                if(i < len){
                    treeSet.add(new pare(array[i], i));
                    if(i - sdv - 1 >= 0){
                        treeSet.remove(new pare(array[i - sdv - 1], i - sdv - 1));
                    }
                }
                else if(i + sdv >= w){
                    if(len - 1 - sdv >= 0) {
                        treeSet.remove(new pare(array[len - 1 - sdv], len - 1 - sdv));
                    }
                    --sdv;
                }
                else{
                    to_add(1, 0, new_w, i, w - len, Math.max(treeSet.last().val, 0));
                    i = w - len - 1;
                    continue;
                }
                if(i >= len || len +  i < w){
                    ans[i] += Math.max(treeSet.last().val, 0);
                }
                else{
                    ans[i] += treeSet.last().val;
                }
            }
        }
        for(int i = 0; i < new_w; ++i){
            add[i * 2] += add[i];
            add[i * 2 + 1] += add[i];
            add[i] = 0;
        }
        for(int i = new_w; i < new_w + w; ++i){
            ans[i - new_w] += add[i];
        }
        StringBuilder ss = new StringBuilder();
        for(int i = 0; i < w; ++i){
            ss.append(ans[i]);
            ss.append(' ');
        }
        writer.print(ss);
        writer.close();
    }
}