Assignment Problem

아직 제출이 없습니다시간 제한4초메모리 제한256 MB

문제

There are mm open positions in our company and nmn \ge m candidates for these positions. We want to hire the best candidates, obviously. We can't hire the same candidate for two or more different positions, so we have to hire exactly mm candidates. Let's call the way to choose different candidates for each position an assignment. Two assignments are different if there exists a position for which we hire different candidates in these assignments.

There is a matrix AA of profits: A_ij0A\_{ij} \ge 0 denotes what profit we will gain from hiring jj-th candidate for ii-th position. We want to maximize the sum of profits we will gain from all hires. An assignment is optimal if it maximizes the sum of profits.

It would be easy to choose the best candidates given the matrix AA. Unfortunately, HR world is not so simple, and they can't provide the matrix AA for you. Even after interviewing all the candidates we can only compare how two candidates will behave in the same position. More precisely, we know mm permutations P_iP\_{i} of length nn. For all 1im1 \le i \le m, 1x<yn1 \le x < y \le n: A_iP_ix>A_iP_iyA\_{i P\_{ix}} > A\_{i P\_{iy}}. In human words, for each position we know the ranking of all candidates.

A candidate is promising if and only if there exists a matrix AA which is consistent with all the given rankings, such that for this matrix there is only one optimal assignment and this particular candidate is hired.

You are to find all promising candidates so that we can conduct more thorough tests with them.

입력

The first line contains two integers nn and mm (1m111 \le m \le 11, mn1000m \le n \le 1000) --- the number of candidates and the number of positions.

Next mm lines contain rankings for each position. The ii-th line contains a permutation P_i1,P_i2,,P_inP\_{i1}, P\_{i2}, \ldots, P\_{in} of numbers from 11 to nn.

출력

In the first line print the number of promising candidates, in the second line print indices of promising candidates in increasing order.