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

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

    static class TaskE {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int numArrays = in.nextInt();
            int w = in.nextInt();
            long[] add = new long[w + 1];
            long[] ans = new long[w];
            for (int arrayId = 0; arrayId < numArrays; arrayId++) {
                int n = in.nextInt();
                int[] a = new int[n];
                for (int i = 0; i < n; i++) {
                    a[i] = in.nextInt();
                }

                RMQ rmq = new RMQ(a);

                int l = n;
                int r = w - n - 1;
                if (l <= r) {
                    int max = rmq.getMax(0, n - 1);
                    max = Math.max(max, 0);
                    add[l] += max;
                    add[r + 1] -= max;
                }

                for (int i = 0; i < n; i++) {
                    process(i, w, n, rmq, ans);
                }

                for (int i = w - n; i < w; i++) {
                    if (i < n) {
                        // Already counted.
                        continue;
                    }
                    process(i, w, n, rmq, ans);
                }
            }

            long cur = 0;
            for (int i = 0; i < w; i++) {
                cur += add[i];
                ans[i] += cur;
                if (i > 0) {
                    out.print(" ");
                }
                out.print(ans[i]);
            }
            out.println();
        }

        private void process(int i, int w, int n, RMQ rmq, long[] ans) {
            int left = i - (w - n);
            int right = i;

            int l = Math.max(left, 0);
            int r = Math.min(right, n - 1);
            if (l > r) {
                throw new AssertionError();
            }
            int max = rmq.getMax(l, r);
            if (left < 0) {
                max = Math.max(max, 0);
            }
            if (right > n - 1) {
                max = Math.max(max, 0);
            }
            ans[i] += max;
        }

        private class RMQ {
            int[][] t;
            int[] logs;

            RMQ(int[] a) {
                int n = a.length;
                logs = new int[n + 1];
                for (int i = 2; i <= n; i++) {
                    logs[i] = logs[i - 1];
                    while ((1 << logs[i]) <= i) {
                        ++logs[i];
                    }
                    --logs[i];
                }

                t = new int[logs[n] + 1][n];
                for (int log = 0; log < t.length; log++) {
                    for (int i = 0; i + (1 << log) <= n; i++) {
                        if (log == 0) {
                            t[log][i] = a[i];
                        } else {
                            t[log][i] = Math.max(t[log - 1][i], t[log - 1][i + (1 << (log - 1))]);
                        }
                    }
                }
            }

            int getMax(int l, int r) {
                if (l > r) {
                    return -1;
                }
                int log = logs[r - l + 1];
                return Math.max(t[log][l], t[log][r - (1 << log) + 1]);
            }

        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

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

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

    }
}