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 E1208 {

	static int w;
	static SegmentTree2 ans;
	public static void solve(int [] in,int l) {
		SegmentTree st = new SegmentTree(in);
		for(int i =1;i<=l;i++) {
			int x =st.query(Math.max(i-(w-l),1),i);
			if(i>=l+1 || i<=w-l) x=Math.max(x, 0);
			ans.update_point(i, x);
		}
		for(int i =w;i>=w-l+1;i--) {
			if(i==l)
				return;
			int x =st.query(l-(w-i),Math.min(l-(w-i)+(w-l),l));
			if(i<=w-l || i>=l+1) x=Math.max(x, 0);
			ans.update_point(i, x);
		}
		int t = st.query(1, l);
		ans.update_range(l+1, w-l, Math.max(t, 0));
		
//		ans.range_update(l+1, w-l, st.query(1,l));
		
	}
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		w = sc.nextInt();
		int M = 1;
		while(M<w)
			M*=2;
		ans = new SegmentTree2(new long[M+1]);
		while(n-->0) {
			int l = sc.nextInt();
			int N =1;
			while(N<l)
				N*=2;
			int [] in = new int [N+1];
			for(int i=1;i<=l;i++)
				in[i]=sc.nextInt();
			for(int i=l+1;i<=N;i++)
				in[i]=-(int)1e9;
			solve(in,l);
//			for(int i=1;i<=w;i++) {
//				pw.print(ans.query(i, i)+" ");
//			}
//			pw.println();
		}
		for(int i=1;i<=w;i++) {
			pw.print(ans.query(i, i)+" ");
		}
		pw.close();
	}

	static class SegmentTree2 {		// 1-based DS, OOP
		
		int N; 			//the number of elements in the array as a power of 2 (i.e. after padding)
		long[] array, sTree, lazy;
		
		SegmentTree2(long[] in)		
		{
			array = in; N = in.length - 1;
			sTree = new long[N<<1];		//no. of nodes = 2*N - 1, we add one to cross out index zero
			lazy = new long[N<<1];
			build(1,1,N);
		}
		
		void build(int node, int b, int e)	// O(n)
		{
			if(b == e)					
				sTree[node] = array[b];
			else						
			{
				int mid = b + e >> 1;
				build(node<<1,b,mid);
				build(node<<1|1,mid+1,e);
				sTree[node] = sTree[node<<1]+sTree[node<<1|1];
			}
		}
		
		
		void update_point(int index, int val)			// O(log n)
		{
			index += N - 1;				
			sTree[index] += val;			
			while(index>1)				
			{
				index >>= 1;
				sTree[index] = sTree[index<<1] + sTree[index<<1|1];		
			}
		}
		
		
		void update_range(int i, int j, int val)		// O(log n) 
		{
			update_range(1,1,N,i,j,val);
		}
		
		void update_range(int node, int b, int e, int i, int j, int val)
		{
			if(i > e || j < b)		
				return;
			if(b >= i && e <= j)		
			{
				sTree[node] += (e-b+1)*val;			
				lazy[node] += val;				
			}							
			else		
			{
				int mid = b + e >> 1;
				propagate(node, b, mid, e);
				update_range(node<<1,b,mid,i,j,val);
				update_range(node<<1|1,mid+1,e,i,j,val);
				sTree[node] = sTree[node<<1] + sTree[node<<1|1];		
			}
			
		}
		void propagate(int node, int b, int mid, int e)		
		{
			lazy[node<<1] += lazy[node];
			lazy[node<<1|1] += lazy[node];
			sTree[node<<1] += (mid-b+1)*lazy[node];		
			sTree[node<<1|1] += (e-mid)*lazy[node];		
			lazy[node] = 0;
		}
		
		long query(int i, int j)
		{
			return query(1,1,N,i,j);
		}
		
		long query(int node, int b, int e, int i, int j)	// O(log n)
		{
			if(i>e || j <b)
				return 0;		
			if(b>= i && e <= j)
				return sTree[node];
			int mid = b + e >> 1;
			propagate(node, b, mid, e);
			long q1 = query(node<<1,b,mid,i,j);
			long q2 = query(node<<1|1,mid+1,e,i,j);
			return q1 + q2;	
					
		}
	}

	static class SegmentTree { // 1-based DS, OOP

		int N; // the number of elements in the array as a power of 2 (i.e. after padding)
		int[] array, sTree;

		SegmentTree(int[] in) {
			array = in;
			N = in.length - 1;
			sTree = new int[N << 1]; // no. of nodes = 2*N - 1, we add one to cross out index zero

			build(1, 1, N);
		}

		void build(int node, int b, int e) // O(n)
		{
			if (b == e)
				sTree[node] = array[b];
			else {
				int mid = b + e >> 1;
				build(node << 1, b, mid);
				build(node << 1 | 1, mid + 1, e);
				sTree[node] = Math.max(sTree[node << 1], sTree[node << 1 | 1]);
			}
		}

		int query(int i, int j) {
			return query(1, 1, N, i, j);
		}

		int query(int node, int b, int e, int i, int j) // O(log n)
		{
			if (i > e || j < b)
				return -(int)1e9;
			if (b >= i && e <= j)
				return sTree[node];
			int mid = b + e >> 1;

			int q1 = query(node << 1, b, mid, i, j);
			int q2 = query(node << 1 | 1, mid + 1, e, i, j);
			return Math.max(q1, q2);

		}

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

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

		public Scanner(FileReader r) {
			br = new BufferedReader(r);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}
}