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:
//stan hu tao
//join nct ridin by first year culture reps
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;

public class x1208E
{
    public static void main(String hi[]) throws Exception
    {
        FastScanner infile = new FastScanner();
        int T = infile.nextInt();
        int K = infile.nextInt();
        long[] sums = new long[K];
        while(T-->0)
        {
            int N = infile.nextInt();
            int[] arr = infile.nextInts(N);
            if(2*N > K)
            {
                int lol = K-N;
                TreeMap<Integer, Integer> mset = new TreeMap<Integer, Integer>();
                for(int i=0; i < K; i++)
                {
                    if(i < N)
                        push(mset, arr[i]);
                    int val = mset.lastKey();
                    if(i+N < K || i >= N)
                        val = max(val, 0);
                    sums[i] += val;
                    if(i+1 < K)
                        sums[i+1] -= val;
                    if(i >= lol)
                        pull(mset, arr[i-lol]);
                }
            }
            else
            {
                int[] prefix = new int[N];
                prefix[0] = arr[0];
                for(int i=1; i < N; i++)
                    prefix[i] = max(prefix[i-1], arr[i]);
                int[] suffix = new int[N];
                suffix[N-1] = arr[N-1];
                for(int i=N-2; i >= 0; i--)
                    suffix[i] = max(suffix[i+1], arr[i]);
                //prefixes
                for(int i=0; i < N; i++)
                {
                    int val = max(0, prefix[i]);
                    sums[i] += val;
                    sums[i+1] -= val;
                }
                //suffixes
                for(int i=K-1; i >= K-N+1; i--)
                {
                    int val = max(0, suffix[i-K+N]);
                    sums[i] += val;
                    if(i+1 < K)
                        sums[i+1] -= val;
                }
                //middle
                sums[N] += max(0, prefix[N-1]);
                if(N > 1)
                    sums[K-N+1] -= max(0, prefix[N-1]);
            }
        }
        StringBuilder sb = new StringBuilder();
        long res = 0L;
        for(long x: sums)
        {
            res += x;
            sb.append(res+" ");
        }
        System.out.println(sb);
    }
    public static void push(TreeMap<Integer, Integer> map, int k)
    {
        if(!map.containsKey(k))
            map.put(k, 1);
        else
            map.put(k, map.get(k)+1);
    }
    public static void pull(TreeMap<Integer, Integer> map, int k)
    {
        int lol = map.get(k);
        if(lol == 1)
            map.remove(k);
        else
            map.put(k, lol-1);
    }
}
/*
4 7
2 -1 -3
5 1 0 -3 7 2
4 4 3 2 1
1 1

1 7
1 1


 */
class FastScanner
{
    private int BS = 1 << 16;
    private char NC = (char) 0;
    private byte[] buf = new byte[BS];
    private int bId = 0, size = 0;
    private char c = NC;
    private double cnt = 1;
    private BufferedInputStream in;

    public FastScanner() {
        in = new BufferedInputStream(System.in, BS);
    }

    public FastScanner(String s) {
        try {
            in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
        } catch (Exception e) {
            in = new BufferedInputStream(System.in, BS);
        }
    }

    private char getChar() {
        while (bId == size) {
            try {
                size = in.read(buf);
            } catch (Exception e) {
                return NC;
            }
            if (size == -1) return NC;
            bId = 0;
        }
        return (char) buf[bId++];
    }

    public int nextInt() {
        return (int) nextLong();
    }

    public int[] nextInts(int N) {
        int[] res = new int[N];
        for (int i = 0; i < N; i++) {
            res[i] = (int) nextLong();
        }
        return res;
    }

    public long[] nextLongs(int N) {
        long[] res = new long[N];
        for (int i = 0; i < N; i++) {
            res[i] = nextLong();
        }
        return res;
    }

    public long nextLong() {
        cnt = 1;
        boolean neg = false;
        if (c == NC) c = getChar();
        for (; (c < '0' || c > '9'); c = getChar()) {
            if (c == '-') neg = true;
        }
        long res = 0;
        for (; c >= '0' && c <= '9'; c = getChar()) {
            res = (res << 3) + (res << 1) + c - '0';
            cnt *= 10;
        }
        return neg ? -res : res;
    }

    public double nextDouble() {
        double cur = nextLong();
        return c != '.' ? cur : cur + nextLong() / cnt;
    }

    public double[] nextDoubles(int N) {
        double[] res = new double[N];
        for (int i = 0; i < N; i++) {
            res[i] = nextDouble();
        }
        return res;
    }

    public String next() {
        StringBuilder res = new StringBuilder();
        while (c <= 32) c = getChar();
        while (c > 32) {
            res.append(c);
            c = getChar();
        }
        return res.toString();
    }

    public String nextLine() {
        StringBuilder res = new StringBuilder();
        while (c <= 32) c = getChar();
        while (c != '\n') {
            res.append(c);
            c = getChar();
        }
        return res.toString();
    }

    public boolean hasNext() {
        if (c > 32) return true;
        while (true) {
            c = getChar();
            if (c == NC) return false;
            else if (c > 32) return true;
        }
    }
}