#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr[100][100];
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++) cin >> arr[i][j];
  vector<int> answer_seq;
  int answer = 10000000;
  for (int i = 0; i < n - 1; i++) {
    vector<pair<int, int>> seq;
    vector<int> pseq;
    for (int j = 0; j < m; j++) {
      seq.push_back({arr[j][i] - arr[j][n - 1], j + 1});
    }
    sort(seq.begin(), seq.end());
    int sum = 0, panswer = 0;
    for (int z = m - 1; z >= 0; z--) {
      sum += seq[z].first;
      if (sum >= 0) {
        pseq.push_back(seq[z].second);
        panswer++;
      }
    }
    if (answer > m - panswer) {
      answer = m - panswer;
      answer_seq = pseq;
    }
  }
  cout << answer << endl;
  for (int i = 1; i <= m; i++) {
    bool ok = true;
    for (auto a : answer_seq) {
      if (i == a) ok = false;
    }
    if (ok == true) cout << i << " ";
  }
  return 0;
}
