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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ELetThemSlide solver = new ELetThemSlide();
        solver.solve(1, in, out);
        out.close();
    }

    static class ELetThemSlide {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int w = in.nextInt();

            int[][] a = new int[n][];
            for (int i = 0; i < n; i++) {
                int s = in.nextInt();
                a[i] = in.readIntArray(s);
            }

            long[] diffs = new long[w];

            long[] values = new long[w];

            for (int[] row : a) {
                int l = row.length;

                IntMaxSegmentTree max = new IntMaxSegmentTree(l);
                for (int i = 0; i < l; i++) {
                    max.update_LAZY(i, row[i]);
                }
                max.rebuild();

                for (int wIndex = 0; wIndex < w; wIndex++) {
                    values[wIndex] = max.query(Math.max(0, l - (w - wIndex)), Math.min(l, wIndex + 1));
                    if (values[wIndex] < 0) {
                        if (wIndex >= l || w - (wIndex + 1) >= l) {
                            values[wIndex] = 0;
                        }
                    }

                    if (wIndex == l) {
                        wIndex = Math.max(wIndex, w - l - 2);
                    }
                }

                diffs[0] += values[0];
                for (int wIndex = 1; wIndex < w; wIndex++) {
                    if (wIndex == w - l - 1) {
                        diffs[wIndex] += values[wIndex] - values[Math.min(l, wIndex - 1)];
                    } else {
                        diffs[wIndex] += values[wIndex] - values[wIndex - 1];
                    }
                    if (wIndex == l) {
                        wIndex = Math.max(wIndex, w - l - 2);
                    }
                }
            }

            long[] answer = new long[w];
            answer[0] = diffs[0];
            for (int i = 1; i < w; i++) {
                answer[i] = answer[i - 1] + diffs[i];
            }
            out.println(Util.join(answer));
        }

    }

    static class IntMaxSegmentTree {
        public int size;
        public int[] value;
        protected final int identityElement;

        public IntMaxSegmentTree(int size) {
            this.size = size;
            value = new int[2 * size];
            this.identityElement = Integer.MIN_VALUE;
            Arrays.fill(value, identityElement);
        }

        public void rebuild() {
            for (int i = size - 1; i > 0; i--) {
                value[i] = Math.max(value[2 * i], value[2 * i + 1]);
            }
        }

        public void update_LAZY(int i, int v) {
            i += size;
            value[i] = v;
        }

        public int query(int i, int j) {
            int res_left = identityElement, res_right = identityElement;
            for (i += size, j += size; i < j; i /= 2, j /= 2) {
                if ((i & 1) == 1) {
                    res_left = Math.max(res_left, value[i++]);
                }
                if ((j & 1) == 1) {
                    res_right = Math.max(value[--j], res_right);
                }
            }
            return Math.max(res_left, res_right);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] readIntArray(int n) {
            int[] x = new int[n];
            for (int i = 0; i < n; i++) {
                x[i] = nextInt();
            }
            return x;
        }

    }

    static class Util {
        public static String join(long... i) {
            StringBuilder sb = new StringBuilder();
            for (long o : i) {
                sb.append(o);
                sb.append(" ");
            }
            if (sb.length() > 0) {
                sb.deleteCharAt(sb.length() - 1);
            }
            return sb.toString();
        }

    }
}