#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e6 + 5;
const int Inf = 1e9 + 7;
int n, m;
int c[110][110];
int res[110];
struct node {
  int dx, id;
} a[110];
bool vis[110];
int cnt = 0;
bool cmp(node a, node b) { return a.dx < b.dx; }
int main() {
  scanf(" %d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      scanf(" %d", &c[i][j]);
      res[j] += c[i][j];
    }
  }
  int cut[2], sz = Inf;
  vector<int> ans, tmp;
  for (int x = 1; x < n; x++) {
    tmp.clear();
    for (int i = 1; i <= m; i++) {
      a[i].dx = c[i][x] - c[i][n];
      a[i].id = i;
    }
    sort(a + 1, a + m + 1, cmp);
    int ck = 1, flag = 0;
    cut[0] = res[x], cut[1] = res[n];
    while (ck <= m) {
      if (cut[0] - a[ck].dx >= cut[1]) {
        tmp.push_back(a[ck].id);
        flag = 1;
        break;
      }
      tmp.push_back(a[ck].id);
      cut[0] -= a[ck].dx;
      ck++;
    }
    if (flag) {
      if (tmp.size() < sz) {
        ans.clear();
        for (int i = 0; i < tmp.size(); i++) {
          ans.push_back(tmp[i]);
        }
        sz = tmp.size();
      }
    }
  }
  int flag = 0;
  for (int i = 1; i < n; i++) {
    if (res[i] >= res[n]) {
      flag = 1;
      break;
    }
  }
  if (flag) ans.clear();
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++) {
    printf("%d ", ans[i]);
  }
  printf("\n");
  return 0;
}
