#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
void print(vector<int> &a, int N) {
  set<int> S;
  for (int i = 0; i < N; i++) S.insert(i);
  for (auto I : a) S.erase(I);
  for (auto I : S) cout << I + 1 << ' ';
  cout << endl;
}
int main() {
  int W, H;
  cin >> W >> H;
  vector<vector<int>> a(H, vector<int>(W));
  for (int i = 0; i < H; i++)
    for (int j = 0; j < W; j++) cin >> a[i][j];
  int mx = 0;
  vector<int> ans;
  for (int j = 0; j < W - 1; j++) {
    vector<P> d(H);
    for (int i = 0; i < H; i++) d[i] = {a[i][j] - a[i][W - 1], i};
    sort(d.begin(), d.end(), greater<P>());
    int sum = 0, cnt = 0;
    vector<int> cand;
    for (int i = 0; i < H; i++) {
      if (sum + d[i].first >= 0) {
        sum += d[i].first;
        cnt++;
        cand.push_back(d[i].second);
      }
    }
    if (cnt > mx) {
      mx = cnt;
      ans = cand;
    }
  }
  cout << H - mx << endl;
  print(ans, H);
  return 0;
}
