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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
inline bool checkBit(long long n, long long i) {
  return n & ((long long)1 << i);
}
inline long long setBit(long long n, long long i) {
  return n | ((long long)1 << i);
  ;
}
inline long long resetBit(long long n, long long i) {
  return n & (~((long long)1 << i));
}
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline bool isLeapYear(long long year) {
  return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}
inline void normal(long long &a) { a = (a + 998244353) % 998244353; }
inline long long modMul(long long a, long long b) {
  a %= 998244353, b %= 998244353;
  normal(a), normal(b);
  return (a * b) % 998244353;
}
inline long long modAdd(long long a, long long b) {
  a %= 998244353, b %= 998244353;
  normal(a), normal(b);
  return (a + b) % 998244353;
}
inline long long modSub(long long a, long long b) {
  a %= 998244353, b %= 998244353;
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
inline long long modPow(long long b, long long p) {
  long long r = 1;
  while (p) {
    if (p & 1) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1;
  }
  return r;
}
inline long long modInv(long long a) { return modPow(a, 998244353 - 2); }
inline long long modDiv(long long a, long long b) {
  return modMul(a, modInv(b));
}
inline long long fact(long long r) {
  long long ans = 1;
  while (r) ans = modMul(ans, r), r--;
  return ans;
}
inline long long invfact(long long r) {
  long long ans = 1;
  while (r) ans = modMul(ans, modInv(r)), r--;
  return ans;
}
inline double dgcd(double a, double b) {
  if (a < b) return dgcd(b, a);
  if (b < .0001) return a;
  return dgcd(b, fmod(a, b));
}
const long long N = 1e6 + 1;
vector<long long> a, ans(N);
long long n, w, len, l, r;
struct sparseTable {
  vector<vector<long long> > s;
  long long LOG;
  void make(long long n) {
    LOG = 64 - __builtin_clzll(n);
    s.resize(LOG);
    s[0] = a;
    for (long long i = 1; i < LOG; i++) {
      s[i].resize(n - (long long)pow((long long)2, i) + 1);
      for (long long j = 0; j <= n - (long long)pow((long long)2, i); j++) {
        s[i][j] =
            max(s[i - 1][j], s[i - 1][j + (long long)pow((long long)2, i - 1)]);
      }
    }
  }
  long long mmax(long long l, long long r) {
    long long ans = -(long long)2e18;
    for (long long i = LOG - 1; i >= 0; i--) {
      if (l + (long long)pow((long long)2, i) - 1 <= r)
        ans = max(s[i][l], ans), l += (long long)pow((long long)2, i);
    }
    return ans;
  }
} st;
void solve() {
  cin >> n >> w;
  ans.resize(w + 1);
  while (n--) {
    cin >> len;
    a.resize(len);
    for (long long i = 0; i < len; i++) {
      cin >> a[i];
    }
    st.make(len);
    for (long long i = 0; i < w; i++) {
      l = max(len - w + i, (long long)0);
      r = min(i, len - 1);
      long long x = st.mmax(l, r);
      if (w - i > len || i >= len) x = max(x, (long long)0);
      ans[i] += x;
      if (i == len - 1) i = max(w - len, i);
      ans[i + 1] -= x;
    }
  }
  for (long long i = 0; i < w; i++) {
    cout << ans[i] << " ";
    ans[i + 1] += ans[i];
  }
  cout << endl;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  while (t--) {
    solve();
  }
}