#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<vector<int> > res(N);
  for (int i = (0); i < (M); i++) {
    for (int j = (0); j < (N); j++) {
      int x;
      cin >> x;
      res[j].push_back(x);
    }
  }
  for (int i = (0); i < (N - 1); i++) {
    for (int j = (0); j < (M); j++) res[i][j] -= res[N - 1][j];
  }
  int mx = 0;
  vector<int> ans;
  for (int i = (0); i < (N - 1); i++) {
    vector<pair<int, int> > x;
    for (int j = (0); j < (M); j++) x.emplace_back(res[i][j], j);
    sort((x).begin(), (x).end(), greater<pair<int, int> >());
    vector<int> tans;
    int sum = 0;
    for (auto& it : x) {
      if (sum + it.first >= 0) {
        sum += it.first;
        tans.push_back(it.second);
      }
    }
    if ((int)(tans).size() > mx) {
      mx = (int)(tans).size();
      ans = tans;
    }
  }
  cout << M - mx << endl;
  vector<bool> cancel(M, true);
  for (auto& it : ans) cancel[it] = false;
  for (int i = (0); i < (M); i++)
    if (cancel[i]) cout << i + 1 << " ";
  cout << endl;
}
