#include<cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
map<int,int> mp;
int main()
{
int m,n,u;
scanf("%d %d",&m,&n);
for(int i = 0; i < n; i++)
{
for(int j = 0; j < m; j++)
{
scanf("%d",&u);
if(mp.find(u) != mp.end())
mp[u]++;
else
{
mp[u] = 1;
}
}
}
int k = -1,t=-1;
for(map<int,int> :: iterator it = mp.begin();it != mp.end(); it++ )
{
if(it->second > k)
{
k = it->second;
t = it->first;
}
}
printf("%d",t);
return 0;
}