Problem Statement
Mark is hosting a sports meet. There are 'N' people who will participate. These people are being conveniently numbered 1 through N. Also, there are M options of sports for this event. These sports are numbered 1 through M. Among these options, Mark will select one or more sports (possibly all) to be played in the event.
Mark knows that Person i's j- t h favorite sport is Sport A i j. Each person will only participate in his/her most favorite sport among the ones that are actually played in the event, and will not participate in the other sports.
Mark is worried that one of the sports will attract too many people. Therefore, he would like to carefully select sports to be played so that the number of participants in the most favorite sport is minimized. Find the minimum possible number of participants in the most favorite sport.
Constraints
1<=N<=300
1<=M<=300
Ai1 , Ai2 , ...... , AiM is a permutation of the integers from 1 to M.
Input Format
N M
A11 A12 ...... A1M
A21 A22 ...... A2M
::
AN1 AN2 ...... ANM
Output Format
Print the minimum possible number of the participants in the most favorite sport.
Sample
Test case #0
Test case Input
4 5
5 1 3 4 2
2 5 3 1 4
2 3 1 4 5
2 5 4 3 1
Test case Output
2
Explanation
Assume that Sports 1, 3 and 4 are selected to be conducted. In this case, Person 1 will participate in sport 1, Person 2 in sport 3, Person 3 in sport 3 and Person 4 in sport 4. Here, the sport with the largest number of participants is sport 3, with two participants. There is no way to reduce the number of participants in the sport with the largest number of participants to 1. Therefore, the answer is 2.
Sample Test case #1
Test case Input
3 3
2 1 3
2 1 3
2 1 3
Test case Output
3
Explanation
Since all the people have the same taste in sports, there will be a sport with three participants, no matter what sports are selected. Therefore, the answer is 3.