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 A {
    FastScanner in;
    PrintWriter out;

    class ST {
        int[] minPos;
        long[] minValue;
        long[] add;

        ST(long[] vals) {
            int n = vals.length;
            minPos = new int[n * 4];
            minValue = new long[n * 4];
            add = new long[n * 4];
            build(0, 0, n - 1, vals);
        }

        void build(int v, int l, int r, long[] vals) {
            if (l == r) {
                minPos[v] = l;
                minValue[v] = vals[l];
                add[v] = vals[l];
            } else {
                int m = (l + r) >> 1;
                build(v * 2 + 1, l, m, vals);
                build(v * 2 + 2, m + 1, r, vals);
                relax(v);
            }
        }

        void relax(int v) {
            if (minValue[v * 2 + 1] < minValue[v * 2 + 2]) {
                minValue[v] = minValue[v * 2 + 1] + add[v];
                minPos[v] = minPos[v * 2 + 1];
            } else {
                minValue[v] = minValue[v * 2 + 2] + add[v];
                minPos[v] = minPos[v * 2 + 2];
            }
        }

        void add(int v, int l, int r, int needL, int needR, long delta) {
            if (needL > r || needR < l) {
                return;
            }
            if (needL <= l && needR >= r) {
                add[v] += delta;
                minValue[v] += delta;
            } else {
                int m = (l + r) >> 1;
                add(v * 2 + 1, l, m, needL, needR, delta);
                add(v * 2 + 2, m + 1, r, needL, needR, delta);
                relax(v);
            }
        }

        long[] t = new long[]{-1, Long.MAX_VALUE / 10};

        long[] getMin(int v, int l, int r, int needL, int needR) {
            if (needL > r || needR < l) {
                return t;
            }
            if (needL <= l && needR >= r) {
                return new long[]{minPos[v], minValue[v]};
            } else {
                int m = (l + r) >> 1;
                long[] t1 = getMin(v * 2 + 1, l, m, needL, needR);
                long[] t2 = getMin(v * 2 + 2, m + 1, r, needL, needR);
                if (t1[1] < t2[1]) {
                    return new long[]{t1[0], t1[1] + add[v]};
                } else {
                    return new long[]{t2[0], t2[1] + add[v]};
                }
            }
        }
    }

    void solve() {
        int n = in.nextInt();
        int w = in.nextInt();
        long[] sum = new long[w + 1];
        for (int i = 0; i < n; i++) {
            int len = in.nextInt();
            long[] a = new long[len];
            long mx = 0;
            for (int j = 0; j < len; j++) {
                a[j] = -in.nextInt();
                mx = Math.max(mx, -a[j]);
            }
            ST st = new ST(a);
            int inter = len * 2 + 3;
            for (int pos = 0; pos < w; pos++) {
                if (pos == inter && pos + inter + 5 < w) {
                    sum[pos] += mx;
                    pos = w - inter;
                    sum[pos] -= mx;
                }
                int firstElem = pos - (w - len);
                long[] tt = st.getMin(0, 0, len - 1, firstElem, pos);
                long maxAns = -tt[1];
                if (firstElem < 0 || pos >= len) {
                    maxAns = Math.max(maxAns, 0);
                }
                sum[pos] += maxAns;
                sum[pos + 1] -= maxAns;
            }
        }
        long r = 0;
        for (int i = 0; i < w; i++) {
            r += sum[i];
            out.print(r + " ");
        }
    }

    void run() {
        try {
            in = new FastScanner(new File("A.in"));
            out = new PrintWriter(new File("A.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

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

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    public static void main(String[] args) {
        new A().runIO();
    }
}