#include <bits/stdc++.h>
using namespace std;
int max(int x, int y) {
  if (x < y) return y;
  return x;
}
int calc_biggest_groups(int *row1, int *row2, int n) {
  int A = 0, B = 0, C = 0, D = 0;
  for (int i = 1; i <= n; i++) {
    if (row1[i] == 1 && row2[i] == 1) {
      A++;
    } else if (row1[i] == 1 && row2[i] == 0) {
      B++;
    } else if (row1[i] == 0 && row2[i] == 1) {
      C++;
    } else if (row1[i] == 0 && row2[i] == 0) {
      D++;
    }
  }
  return max(max(A, B), max(C, D));
}
int main() {
  int n, m;
  int a[101][101];
  cin >> n >> m;
  int min = 200;
  int x = 0, y = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[j][i];
    }
  }
  for (int i = 1; i <= m; i++) {
    for (int j = i; j <= m; j++) {
      if (i != j) {
        int current = calc_biggest_groups(a[i], a[j], n);
        if (current < min) {
          min = current;
          x = i;
          y = j;
        }
      }
    }
  }
  cout << min << endl << x << " " << y << endl;
}
