#include<cstdio>
#include<iostream>
#include<cstdio>
#include<unordered_map>
#include<algorithm>
using namespace std;
int main()
{
unordered_map<int,int>cnt;
int n,m;
cin>>n>>m;
for(int i=0;i<m;++i)
for(int t,j=0;j<n;++j)
{
scanf("%d",&t);
++cnt[t];
}
cout<<find_if(cnt.begin(),cnt.end(),[&](pair<const int,int>&x){return x.second>(n*m)/2;})->first;
return 0;
}
#include<iostream>
#include<cstdio>
#include<unordered_map>
#include<algorithm>
using namespace std;
int main()
{
unordered_map<int,int>cnt;
int n,m;
cin>>n>>m;
for(int i=0;i<m;++i)
for(int t,j=0;j<n;++j)
{
scanf("%d",&t);
++cnt[t];
}
cout<<find_if(cnt.begin(),cnt.end(),[&](pair<const int,int>&x){return x.second>(n*m)/2;})->first;
return 0;
}