#include <iostream> #define MAXN 200 using namespace std; int mark[MAXN]; int main() { //freopen("acm.acm","r",stdin); int m; int n; int i; int j; int team; int tem; int _max; int ans; while(cin>>m>>n,m||n) { _max = -1; ans = 0; memset(mark,0,sizeof(mark)); for(i = 0; i < m; ++ i) { cin>>team; for(j = 0; j < team; ++ j) { cin>>tem; ++ mark[tem]; } } for(j = 1; j < MAXN; ++ j) { if(_max < mark[j] && mark[j] >= n) { _max = mark[j]; ans = j; } } cout<<ans<<endl; } }
时间: 2024-10-04 00:34:50