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.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * @author khokharnikunj8
 */

public class Main {
    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                new Main().solve();
            }
        }, "1", 1 << 26).start();
    }

    void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(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, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            int w = in.scanInt();
            long[] ans = new long[w + 2];
            long[] individuals = new long[w + 1];
            for (int i = 0; i < n; i++) {
                int li = in.scanInt();
                int[] ar = new int[li + 1];
                for (int j = 1; j <= li; j++) ar[j] = in.scanInt();
                SegmentTreeMax sg = new SegmentTreeMax(ar, li);
                if (w <= 2 * li) {
                    for (int j = 1; j <= w; j++) {
                        int left = Math.max(1, li - (w - j));
                        int right = Math.min(li, j);
                        int what = ar[sg.query(left, right)];
                        if (w - j >= li || j - 1 >= li) what = Math.max(0, what);
                        individuals[j] += what;
                    }
                } else {
                    for (int j = 1; j <= li; j++) {
                        int left = Math.max(1, li - (w - j));
                        int right = Math.min(li, j);
                        int what = ar[sg.query(left, right)];
                        if (w - j >= li || j - 1 >= li) what = Math.max(0, what);
                        individuals[j] += what;
                    }
                    int lt = li + 1;
                    int rt = w - li;
                    if (lt <= rt) {
                        int what = Math.max(0, ar[sg.query(1, li)]);
                        ans[lt] += what;
                        ans[rt + 1] -= what;

                    }
                    for (int j = w - li + 1; j <= w; j++) {
                        int left = Math.max(1, li - (w - j));
                        int right = Math.min(li, j);
                        int what = ar[sg.query(left, right)];
                        if (w - j >= li || j - 1 >= li) what = Math.max(0, what);
                        individuals[j] += what;
                    }

                }

            }
            for (int i = 1; i <= w; i++) ans[i] += ans[i - 1];
            for (int i = 1; i <= w; i++) out.print((individuals[i] + ans[i]) + " ");
        }

    }

    static class SegmentTreeMax {
        int n;
        int[] t;
        int[] data;

        public SegmentTreeMax(int[] data, int n) {
            this.data = data;
            this.n = n;
            this.t = new int[2 * (n + 3)];
            build();
        }

        void build() {
            for (int i = 0; i < n; i++) t[i + n] = i + 1;
            for (int i = n - 1; i > 0; --i)
                t[i] = (data[t[i << 1]] >= data[t[i << 1 | 1]] ? t[i << 1] : t[(i << 1 | 1)]);
        }

        public int query(int l, int r) {
            int res = l;
            for (l += n - 1, r += n; l < r; l >>= 1, r >>= 1) {
                if ((l & 1) != 0) {
                    res = (data[res] > data[t[l]] ? res : t[l]);
                    l++;
                }
                if ((r & 1) != 0) {
                    r--;
                    res = (data[res] > data[t[r]] ? res : t[r]);
                }
            }
            return res;
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}