#include <bits/stdc++.h>
using namespace std;
struct ii {
  int vt, w;
};
bool ss(ii p1, ii p2) { return p1.w > p2.w; }
ii dung[100005];
int a[1005][1005], cot[1005], t[1005], n, m, nT;
void nhap() {
  cin >> m >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      cot[j] += a[i][j];
    }
  }
}
void xuli() {
  int res1 = n + 1, res2 = 0, d, u;
  for (int i = 1; i < m; i++) {
    u = cot[m] - cot[i];
    d = n + 1;
    for (int j = 1; j <= n; j++) t[j] = a[j][m] - a[j][i];
    sort(t + 1, t + 1 + n);
    while (u > 0) {
      d--;
      u = u - t[d];
    }
    if (n - d + 1 < res1) {
      res1 = n - d + 1;
      res2 = i;
    }
  }
  vector<int> ans;
  d = 0;
  u = cot[m] - cot[res2];
  for (int j = 1; j <= n; j++) dung[j].w = a[j][m] - a[j][res2], dung[j].vt = j;
  sort(dung + 1, dung + 1 + n, ss);
  while (u > 0) {
    d++;
    u = u - dung[d].w;
    ans.push_back(dung[d].vt);
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  nhap();
  xuli();
}
