#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int cand_sums[n];
  memset(cand_sums, 0, sizeof cand_sums);
  vector<vector<int>> votes = vector<vector<int>>(m, vector<int>(n, 0));
  vector<priority_queue<pair<int, int>>> bad_stations =
      vector<priority_queue<pair<int, int>>>(n,
                                             priority_queue<pair<int, int>>());
  int in;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      cin >> in;
      cand_sums[j] += in;
      votes[i][j] = in;
      if (j == n - 1) {
        for (int k = 0; k < j; k++) {
          bad_stations[k].push(pair<int, int>(in - votes[i][k], i));
        }
      }
    }
  }
  vector<vector<int>> killed_stations =
      vector<vector<int>>(n - 1, vector<int>());
  for (int i = 0; i < n - 1; i++) {
    while (!bad_stations[i].empty() && cand_sums[i] < cand_sums[n - 1]) {
      pair<int, int> curr = bad_stations[i].top();
      bad_stations[i].pop();
      cand_sums[i] += curr.first;
      killed_stations[i].push_back(curr.second);
    }
  }
  int best = 0;
  int best_size = m + 1;
  for (int i = 1; i < n - 1; i++) {
    if (killed_stations[i].size() < best_size) {
      best = i;
      best_size = killed_stations[i].size();
    }
  }
  cout << killed_stations[best].size() << endl;
  for (int i = 0; i < killed_stations[best].size(); i++) {
    if (i > 0) cout << " ";
    cout << killed_stations[best][i] + 1;
  }
  if (!killed_stations[best].empty()) cout << endl;
  return 0;
}
