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.StringTokenizer;
import java.util.TreeMap;

public class E1208 {
	static class Scanner {
		BufferedReader br;
		StringTokenizer tk = new StringTokenizer("");

		public Scanner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

		public int nextInt() throws IOException {
			if (tk.hasMoreTokens())
				return Integer.parseInt(tk.nextToken());
			tk = new StringTokenizer(br.readLine());
			return nextInt();
		}

		public long nextLong() throws IOException {
			if (tk.hasMoreTokens())
				return Long.parseLong(tk.nextToken());
			tk = new StringTokenizer(br.readLine());
			return nextLong();
		}

		public String next() throws IOException {
			if (tk.hasMoreTokens())
				return (tk.nextToken());
			tk = new StringTokenizer(br.readLine());
			return next();
		}

		public String nextLine() throws IOException {
			tk = new StringTokenizer("");
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			if (tk.hasMoreTokens())
				return Double.parseDouble(tk.nextToken());
			tk = new StringTokenizer(br.readLine());
			return nextDouble();
		}

		public char nextChar() throws IOException {
			if (tk.hasMoreTokens())
				return (tk.nextToken().charAt(0));
			tk = new StringTokenizer(br.readLine());
			return nextChar();
		}

		public int[] nextIntArray(int n) throws IOException {
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) throws IOException {
			long a[] = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public int[] nextIntArrayOneBased(int n) throws IOException {
			int a[] = new int[n + 1];
			for (int i = 1; i <= n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArrayOneBased(int n) throws IOException {
			long a[] = new long[n + 1];
			for (int i = 1; i <= n; i++)
				a[i] = nextLong();
			return a;
		}


	}

	public static void main(String args[]) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					solve();
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}, "1", 1 << 26).start();

	}
	static class BIT{
		int n;
		long t[];
		BIT(int yy){
			n=yy+10;
			t=new long[n];
		}
		void add(int i, long v){
			for(;i<n;i+=i&-i)
				t[i]+=v;
		}
		void add(int l,int r, long v){
			l++;
			r++;
			add(l,v);
			add(r+1,-v);
		}
		long sum(int i){
			i++;
			long ans=0;
			for(;i>0;i-=i&-i){
				ans+=t[i];
			}
			return ans;
		}
	}
	static class MultiSet<T> extends TreeMap<T, Integer>{
		MultiSet(){
			super();
		}
		void add(T x){
			put(x, getOrDefault(x,0)+1);
		}
		void delete(T x){
			int c=get(x);
			if(c==1)
				remove(x);
			else
				put(x,c-1);
		}
		T max(){
			return lastKey();
		}
	}
	static void solve() throws IOException {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n=in.nextInt();
		int w=in.nextInt();
		BIT b=new BIT(w);
		while(n-->0){
			int l=in.nextInt();
			int a[]=in.nextIntArray(l);
			int ws=w-l;
			MultiSet<Integer> ms=new MultiSet<>();
			int st=0, last=-1;
			for(int i=0;i<l;i++){
				ms.add(a[i]);
				if(i-st>ws){
					ms.delete(a[st]);
					st++;
				}
				int max=ms.max();
				if(i-st<ws)
					max=Math.max(max,0);
				if(i<l-1)
					b.add(i,i,max);
				else{
					b.add(i, w-1-(i-st), max);
				}
			}
			while(st<l-1){
				ms.delete(a[st]);
				st++;
				int max=ms.max();
				if((l-1)-st<ws)
					max=Math.max(max,0);
				b.add(ws+st,ws+st,max);
			}
		}
		for(int i=0;i<w;i++){
			out.print(b.sum(i)+" ");
		}
		out.println();
		out.close();

	}
}