#include <bits/stdc++.h>
using namespace std;
int n, m, ans = 1e5;
struct Can {
  int x, id;
  bool operator<(const Can& b) const { return x < b.x; }
} a[105][105], b[105];
vector<int> an;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      scanf("%d", &a[i][j].x);
      a[i][j].id = i;
    }
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j < n; j++) {
      a[i][j].x -= a[i][n].x;
    }
  }
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= m; j++) b[j] = a[j][i];
    sort(b + 1, b + 1 + m);
    int ret = 0, cnt = 0;
    for (int j = m; j >= 1; j--) {
      if (ret + b[j].x < 0)
        break;
      else
        cnt++, ret += b[j].x;
    }
    if (ans > m - cnt) {
      ans = m - cnt;
      an.clear();
      for (int j = 1; j <= m - cnt; j++) an.push_back(b[j].id);
    }
  }
  printf("%d\n", ans);
  for (int i = 0; i < ans; i++) {
    printf("%d%c", an[i], " \n"[i == n]);
  }
  return 0;
}
