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 CF_1208E {
    public static void main(String args[]) throws Exception {
        BufferedScanner in = new BufferedScanner(System.in);
        BufferedPrinter out = new BufferedPrinter(System.out);

        int n = in.nextInt(), w = in.nextInt();
        long[] lp = new long[w];
        long[] ans = new long[w];
        for (int i = 0; i < n; i++) {
            int l = in.nextInt();
            int[] arr = in.nextN(l);

            if (l > w / 2) {
                int space = w - l;
                SlidingMinDeque pq = new SlidingMinDeque(space + 1);
                long curr = 0;
                for (int j = 0; j < space; j++) {
                    pq.add(arr[j]);

                    curr = Math.max(curr, arr[j]);
                    ans[j] += curr;
                }
                for (int j = space; j < w - space; j++) {
                    pq.add(arr[j]);
                    ans[j] += pq.get();
                }
                curr = 0;
                for (int j = 0; j < space; j++) {
                    curr = Math.max(curr, arr[l - 1 - j]);
                    ans[w - 1 - j] += curr;
                }
            } else {
                long curr = 0;
                for (int j = 0; j < l - 1; j++) {
                    curr = Math.max(curr, arr[j]);
                    ans[j] += curr;
                }
                curr = Math.max(curr, arr[l - 1]);

                lp[l - 1] += curr;
                if (l != 1) lp[w - l + 1] -= curr;

                curr = 0;
                for (int j = 0; j < l - 1; j++) {
                    curr = Math.max(curr, arr[l - 1 - j]);
                    ans[w - 1 - j] += curr;
                }
            }
        }

        long curr = 0;
        for (int i = 0; i < w; i++) {
            curr += lp[i];
            ans[i] += curr;

            out.print(ans[i] + " ");
        }

        out.close();
        in.close();
    }

    static class SlidingMinDeque {
        ArrayDeque<Integer> buf;
        ArrayList<Integer> arr;
        int k;

        SlidingMinDeque(int k) {
            this.arr = new ArrayList<>();
            this.k = k;
            this.buf = new ArrayDeque<>(k + 1);
        }

        void add(int val) {
            while (buf.size() > 0 && arr.get(buf.getLast()) < val) buf.pollLast();
            buf.addLast(arr.size());
            arr.add(val);

            if (arr.size() > k && buf.getFirst() < arr.size() - k) buf.pollFirst();
        }

        int get() {
            if(buf.size() == 0) {
                System.out.println(arr);
                return -1;
            }
            return arr.get(buf.getFirst());
        }
    }

    static class BufferedPrinter {
        PrintWriter out;

        BufferedPrinter(OutputStream out) {
            this(new OutputStreamWriter(out));
        }

        BufferedPrinter(Writer out) {
            this.out = new PrintWriter(new BufferedWriter(out));
        }

        void print(Object... os) {
            for (int i = 0; i < os.length; i++) {
                if (i != 0) out.print(' ');
                out.print(os[i]);
            }
        }

        void println(Object... os) {
            print(os);
            out.println();
        }

        void close() {
            out.close();
        }

        void flush() {
            out.flush();
        }
    }

    static class BufferedScanner {
        private final InputStream in;
        private final byte[] buf = new byte[1 << 13];

        int pos, count;

        BufferedScanner(InputStream in) throws IOException {
            this.in = in;
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        int[] nextN(int n) throws IOException {
            int[] ret = new int[n];
            for (int i = 0; i < n; i++) ret[i] = this.nextInt();
            return ret;
        }

        long[] nextNL(int n) throws IOException {
            long[] ret = new long[n];
            for (int i = 0; i < n; i++) ret[i] = this.nextLong();
            return ret;
        }

        private int read() {
            if (count == -1) err();

            try {
                if (pos >= count) {
                    pos = 0;
                    count = in.read(buf);
                    if (count <= 0) return -1;
                }
            } catch (IOException e) {
                err();
            }
            return buf[pos++];
        }

        private static boolean isSpace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private int nextToken() {
            int ret;
            do {
                ret = read();
            } while (isSpace(ret));
            return ret;
        }

        int nextInt() {
            int sign = 1;
            int c = nextToken();
            if (c == '-') {
                sign = -1;
                c = read();
            }

            int ret = 0;
            do {
                if (c < '0' || c > '9') err();
                ret = ret * 10 + c - '0';
                c = read();
            } while (!isSpace(c));
            return sign * ret;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            int c = nextToken();
            do {
                sb.append((char) c);
                c = read();
            } while (!isSpace(c));
            return sb.toString();
        }

        private void err() {
            throw new InputMismatchException();
        }

        void close() throws IOException {
            in.close();
        }

    }
}