There are N tasks and M resources, each task is asked to use some resources and each resource can only be used by at most one task.
You are asked to find the best arrangement to maximum the total number of the compatible tasks.
Input
There are multi test cases.
Each case contains a number of lines. The first line is N and M, 1 <= N, M <= 50. In the following N lines, each task contains one line with many integers separated by exactly one space, which specify the required resources. The index of the resources starts from 0.
Output
For each test case, output one line containing the maximum number of the compatible tasks.