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.util.*;
import java.io.*;
import java.text.*;
public class Main{
    //SOLUTION BEGIN
    //Into the Hardware Mode
    void pre() throws Exception{}
    void solve(int TC)throws Exception{
        int n = ni(), w = ni();
        long[] sum = new long[1+w];
        long[] ans = new long[1+w];
        for(int ww = 0; ww< n; ww++){
            long[] a = new long[ni()];
            long max = 0;
            for(int j = 0; j< a.length; j++){
                a[j] = nl();
                max = Math.max(max, a[j]);
            }
            SegTree t = new SegTree(a);
            if(a.length*2 >= w){
                for(int i = 0; i< w; i++){
                    int l = i-(w-a.length), r = i;
                    long cur = -IINF;
                    if(l<0){
                        cur = 0;
                        l = 0;
                    }
                    if(r>= a.length){
                        cur = 0;
                        r = a.length-1;
                    }
                    cur = Math.max(cur, t.q(l, r));
                    ans[i] += cur;
                }
            }else{
                for(int i = 0; i< a.length; i++){
                    int l = i-(w-a.length), r = i;
                    long cur = -IINF;
                    if(l<0){
                        cur = 0;
                        l = 0;
                    }
                    if(r>= a.length){
                        cur = 0;
                        r = a.length-1;
                    }
                    cur = Math.max(cur, t.q(l, r));
                    ans[i] += cur;
                }
                for(int i = w-a.length; i< w; i++){
                    int l = i-(w-a.length), r = i;
                    long cur = -IINF;
                    if(l<0){
                        cur = 0;
                        l = 0;
                    }
                    if(r>= a.length){
                        cur = 0;
                        r = a.length-1;
                    }
                    cur = Math.max(cur, t.q(l, r));
                    ans[i] += cur;
                }
                sum[a.length] += max;
                sum[w-a.length] -= max;
            }
        }
//        for(long l:sum)p(l+" ");pn("");
        for(int i = 0; i< w; i++){
            if(i>0)sum[i] += sum[i-1];
            p(ans[i]+sum[i]+" ");
        }
        pn("");
    }
    class SegTree{
        int m= 1;
        long[] t;
        public SegTree(long[] a){
            while(m<a.length)m<<=1;
            t = new long[m<<1];
            for(int i = 0; i< a.length; i++)t[i+m] = a[i];
            for(int i = m-1; i>0; i--)t[i] = Math.max(t[i<<1],t[i<<1|1]);
        }
        void u(int p, long add){
            t[p+=m] = add;
            for(p>>=1;p>0;p>>=1)t[p] = Math.max(t[p<<1], t[p<<1|1]);
        }
        long q(int l, int r){
            long ans = -IINF;
            for(l+=m,r+=m+1;l<r;l>>=1,r>>=1){
                if((l&1)==1)ans =Math.max(ans, t[l++]);
                if((r&1)==1)ans =Math.max(ans, t[--r]);
            }
            return ans;
        }
    }
    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    void exit(boolean b){if(!b)System.exit(0);}
    long IINF = (long)1e18, mod = (long)1e9+7;
    final int INF = (int)1e9, MX = (int)2e6+5;
    DecimalFormat df = new DecimalFormat("0.00000000");
    double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-6;
    static boolean multipleTC = false, memory = false, fileIO = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        if(fileIO){
            in = new FastReader("input.txt");
            out = new PrintWriter("output.txt");
        }else {
            in = new FastReader();
            out = new PrintWriter(System.out);
        }
        //Solution Credits: Taranpreet Singh
        int T = (multipleTC)?ni():1;
        pre();
        for(int t = 1; t<= T; t++)solve(t);
        out.flush();
        out.close();
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    
    int digit(long s){int ans = 0;while(s>0){s/=10;ans++;}return ans;}
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n()throws Exception{return in.next();}
    String nln()throws Exception{return in.nextLine();}
    int ni()throws Exception{return Integer.parseInt(in.next());}
    long nl()throws Exception{return Long.parseLong(in.next());}
    double nd()throws Exception{return Double.parseDouble(in.next());}
 
    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }
 
        String next() throws Exception{
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    throw new Exception(e.toString());
                }
            }
            return st.nextToken();
        }
 
        String nextLine() throws Exception{
            String str = "";
            try{   
                str = br.readLine();
            }catch (IOException e){
                throw new Exception(e.toString());
            }  
            return str;
        }
    }
}