#include <bits/stdc++.h>
using namespace std;
int n, m, maxans;
int ans[105];
bool visit[105];
struct pp {
  int val, id;
};
struct node {
  pp sta[105];
} cd[105];
bool cmp(pp x, pp y) { return x.val > y.val; }
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> cd[j].sta[i].val;
      cd[j].sta[i].id = i;
    }
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j < n; j++) cd[j].sta[i].val -= cd[n].sta[i].val;
  }
  for (int i = 1; i < n; i++) {
    sort(cd[i].sta + 1, cd[i].sta + m + 1, cmp);
    int sum = 0, j = 0;
    while (j < m && sum + cd[i].sta[j + 1].val >= 0) sum += cd[i].sta[++j].val;
    if (j > maxans) {
      maxans = j;
      for (int k = 1; k <= j; k++) ans[k] = cd[i].sta[k].id;
    }
  }
  cout << m - maxans << endl;
  for (int i = 1; i <= maxans; i++) visit[ans[i]] = 1;
  for (int i = 1; i <= m; i++) {
    if (!visit[i]) cout << i << ' ';
  }
  return 0;
}
