NIO's OAuth2 Server
时间限制:C/C++/Rust/Pascal 4秒,其他语言8秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

NIO owns an awesome API platform with various functionalities such as "Graph APIs", "Email APIs'' and "Vision APIs''. Today, there are lots of third party applications using NIO's APIs, to better manage the access permission of each API, NIO is developing his own OAuth2 service.

There are K functionalities of the API platform labeled with . In order to call the APIs of the i-th functionality, an OAuth token with the i-th capability is needed.

NIO creates various templates for third party applications to use when doing authorization. If an application uses the j-th template to do authorization, a token with capabilities is granted, using which, the application is able to call functionality .

Each third party application has its API requirements , which means it needs to call APIs of functionalities. To achieve this, the application must do several authorizations using the pre-defined templates to get tokens with enough capabilities.

After defining N templates, NIO wants to know how the user experience of his templates is. Hence, he defines the degree of an application as the minimal authorizations it has to make to meet all its API requirements. If an application's API requirements cannot be satisfied even after using all the templates, just ignore it because NIO doesn't care.

As the intern of NIO, NIO wants you to tell him the number of applications with degree among all possible applications. Two applications are consider different iff some of their API requirements are different.

输入描述:

The first line contains two integers N  and K .

In the i-th of the following N lines describes the i-th pre-defined template. The first integer M_i denotes the number of capabilities the i-th templates can grant, then M_i integers follows.

输出描述:

Output one line containing K integers, the i-th of which is the number of different applications with degree i.
示例1

输入

复制
6 3
1 1
1 2
1 3
2 1 2
2 1 3
2 2 3

输出

复制
6 1 0

说明

For the sample case, degrees of applications \{1\}, \{2\}, \{3\}, \{1,2\}, \{1,3\}, \{2,3\} are all 1 while the degree of application \{1,2,3\} is 2.

If an application's API requirements cannot be satisfied even after using all the templates, please don't count it because NIO doesn't care.