#include <bits/stdc++.h>
int cmp(int a, int b) { return a > b ? a : b; }
int a[(100 + 5)][(100 + 5)], t[(100 + 5)];
int minout;
struct vote {
  int from, del;
  bool operator<(const vote& b) const { return del > b.del; }
} V[(100 + 5)];
int out[(100 + 5)];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    for (int j = 1; j <= n; ++j) {
      scanf("%d", &a[i][j]);
    }
  }
  minout = m + 1;
  for (int i = 1; i < n; ++i) {
    for (int j = 1; j <= m; ++j) V[j] = (vote){j, a[j][i] - a[j][n]};
    std::sort(V + 1, V + 1 + m);
    int cnt = 0, ans = m;
    for (int j = 1; j <= m; ++j) {
      if (cnt + V[j].del < 0) {
        ans = j - 1;
        break;
      }
      cnt += V[j].del;
    }
    if (m - ans < minout) {
      minout = m - ans;
      int i = 1;
      for (int j = ans + 1; j <= m; ++j) {
        out[i++] = V[j].from;
      }
    }
  }
  printf("%d\n", minout);
  for (int i = 1; i <= minout; ++i) printf("%d ", out[i]);
  return 0;
}
