#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[100];
  int n, k, a, i = 0, cuu;
  cin >> n >> k;
  int max = 0;
  int maxv = 0;
  while (i < n * k) {
    cin >> a;
    if (a > maxv) {
      max = i % n;
      maxv = a;
    }
    if ((i + 1) % n == 0) {
      arr[i / n] = max;
      max = maxv = 0;
    }
    i++;
  }
  int sum;
  maxv = 0;
  for (i = 0; i < n; i++) {
    a = 0;
    for (int l = 0; l < k; l++) {
      if (arr[l] == i) {
        a++;
      }
    }
    if (a > maxv) {
      max = i;
      maxv = a;
    }
  }
  cout << max + 1;
  cin >> a;
  return 0;
}
