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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author ilyakor
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    OutputWriter out = new OutputWriter(outputStream);
    TaskE solver = new TaskE();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskE {

    int w;
    int n;
    int[] a;
    RMQSparseTable rmq;

    public void solve(int testNumber, InputReader in, OutputWriter out) {
      // Random random = new Random(0xdead);
      // int N = 1000 * 1000 / 10;
      // w = 1000 * 1000;
      //
      int N = in.nextInt();
      w = in.nextInt();
      long[] d = new long[w + 1];
      for (int it = 0; it < N; ++it) {
        n = in.nextInt();
        // n = random.nextInt(10) + 1;
        a = new int[n];
        for (int i = 0; i < n; ++i) {
          a[i] = -in.nextInt();
        }
        // a[i] = random.nextInt(2 * 1000 * 1000 * 1000) - 1000 * 1000 * 1000;
        rmq = new RMQSparseTable(a);
        if (n * 2 < w) {
          for (int i = 0; i < n; ++i) {
            int val = calc(i);
            d[i] += val;
            d[i + 1] -= val;
          }
          for (int i = w - n; i < w; ++i) {
            int val = calc(i);
            d[i] += val;
            d[i + 1] -= val;
          }
          int L = n, R = w - n - 1;
          if (L <= R) {
            int val = -a[rmq.minPos(0, n - 1)];
            if (val < 0) {
              val = 0;
            }
            // for (int i = L; i <= R; ++i) {
            //     int oval = calc(i);
            //     if (val != oval) {
            //         throw new RuntimeException();
            //     }
            // }
            d[L] += val;
            d[R + 1] -= val;
          }
        } else {
          for (int i = 0; i < w; ++i) {
            int val = calc(i);
            d[i] += val;
            d[i + 1] -= val;
          }
        }
      }
      long cur = 0;
      for (int i = 0; i < w; ++i) {
        cur += d[i];
        out.print(cur + " ");
      }
      out.printLine();
    }

    public int calc(int i) {
      int l = i + n - w, r = i;
      if (l < 0) {
        l = 0;
      }
      if (r >= n) {
        r = n - 1;
      }
      int val = -a[rmq.minPos(l, r)];
      if (val < 0) {
        if (i + n < w || i - n >= 0) {
          val = 0;
        }
      }
      return val;
    }

  }

  static class OutputWriter {

    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
      for (int i = 0; i < objects.length; i++) {
        if (i != 0) {
          writer.print(' ');
        }
        writer.print(objects[i]);
      }
    }

    public void printLine(Object... objects) {
      print(objects);
      writer.println();
    }

    public void close() {
      writer.close();
    }

  }

  static class RMQSparseTable {

    int[] logTable;
    int[][] rmq;
    int[] a;

    public RMQSparseTable(int[] a) {
      this.a = a;
      int n = a.length;

      logTable = new int[n + 1];
      for (int i = 2; i <= n; i++) {
        logTable[i] = logTable[i >> 1] + 1;
      }

      rmq = new int[logTable[n] + 1][n];

      for (int i = 0; i < n; ++i) {
        rmq[0][i] = i;
      }

      for (int k = 1; (1 << k) < n; ++k) {
        for (int i = 0; i + (1 << k) <= n; i++) {
          int x = rmq[k - 1][i];
          int y = rmq[k - 1][i + (1 << k - 1)];
          rmq[k][i] = a[x] <= a[y] ? x : y;
        }
      }
    }

    public int minPos(int i, int j) {
      int k = logTable[j - i];
      int x = rmq[k][i];
      int y = rmq[k][j - (1 << k) + 1];
      return a[x] <= a[y] ? x : y;
    }

  }

  static class InputReader {

    private InputStream stream;
    private byte[] buffer = new byte[10000];
    private int cur;
    private int count;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public static boolean isSpace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public int read() {
      if (count == -1) {
        throw new InputMismatchException();
      }
      try {
        if (cur >= count) {
          cur = 0;
          count = stream.read(buffer);
          if (count <= 0) {
            return -1;
          }
        }
      } catch (IOException e) {
        throw new InputMismatchException();
      }
      return buffer[cur++];
    }

    public int readSkipSpace() {
      int c;
      do {
        c = read();
      } while (isSpace(c));
      return c;
    }

    public int nextInt() {
      int sgn = 1;
      int c = readSkipSpace();
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res = res * 10 + c - '0';
        c = read();
      } while (!isSpace(c));
      res *= sgn;
      return res;
    }

  }
}