#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> statToRemove;
int tSumBad = 0;
bool comp(pair<pair<int, int>, int>& a, pair<pair<int, int>, int>& b) {
  pair<int, int> aa = a.first;
  pair<int, int> bb = b.first;
  if (aa.second - aa.first > bb.second - bb.first) return true;
  return false;
}
int accumGood(vector<pair<pair<int, int>, int>>& statOfCand) {
  int sum = 0;
  for (auto x : statOfCand) sum += x.first.first;
  return sum;
}
void markToDelete(vector<pair<pair<int, int>, int>>& statOfCand, int candInd) {
  int sumGood = 0;
  sumGood = accumGood(statOfCand);
  sort(statOfCand.begin(), statOfCand.end(), comp);
  int sumBad = tSumBad;
  int j = 0;
  for (auto pp : statOfCand) {
    if (sumGood >= sumBad) break;
    auto p = pp.first;
    sumGood -= p.first;
    sumBad -= p.second;
    statToRemove[candInd].push_back(pp.second);
    j++;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int cand;
  cin >> cand;
  int stat;
  cin >> stat;
  statToRemove.resize(cand - 1);
  vector<vector<int>> candidates(cand, vector<int>(stat));
  for (int i = 0; i < stat; i++) {
    for (int j = 0; j < cand; j++) {
      cin >> candidates[j][i];
      if (j == cand - 1) tSumBad += candidates[j][i];
    }
  }
  int lastCand = cand - 1;
  for (int i = 0; i < cand - 1; i++) {
    vector<pair<pair<int, int>, int>> statOfCand;
    for (int j = 0; j < stat; j++) {
      statOfCand.push_back({{candidates[i][j], candidates[lastCand][j]}, j});
    }
    markToDelete(statOfCand, i);
  }
  int candToRemove;
  int mn = INT_MAX;
  for (int i = 0; i < (int)statToRemove.size(); i++) {
    if (mn > (int)statToRemove[i].size()) {
      candToRemove = i;
      mn = (int)statToRemove[i].size();
    }
  }
  cout << mn << '\n';
  for (int i = 0; i < (int)statToRemove[candToRemove].size(); i++) {
    cout << statToRemove[candToRemove][i] + 1 << ' ';
  }
  return 0;
}
