#include <bits/stdc++.h>
using namespace std;
int gi() {
  int a;
  scanf("%d", &a);
  return a;
}
long long gli() {
  long long a;
  scanf("%I64d", &a);
  return a;
}
int v[100][100];
int a[100];
int s[100];
int idx = 0, n, m;
bool fn(int a, int b) {
  return v[a][m - 1] - v[a][idx] > v[b][m - 1] - v[b][idx];
}
int clc() {
  sort(a, a + n, fn);
  int mv = s[m - 1] - s[idx];
  int res = 0;
  while (mv > 0) {
    mv -= v[a[res]][m - 1] - v[a[res]][idx];
    res++;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  m = gi();
  n = gi();
  memset(s, 0, sizeof(s));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      v[i][j] = gi();
      s[j] += v[i][j];
    }
    a[i] = i;
  }
  int w = 0, res = clc();
  for (idx = 1; idx < m - 1; idx++) {
    int alt = clc();
    if (alt < res) {
      w = idx;
      res = alt;
    }
  }
  idx = w;
  sort(a, a + n, fn);
  printf("%d\n", res);
  for (int i = 0; i < res; i++)
    printf("%d%c", a[i] + 1, (i == res - 1 ? '\n' : ' '));
  return 0;
}
