#include <bits/stdc++.h>
using namespace std;
long long n, m;
bool cmp(pair<pair<long long, long long>, long long> a,
         pair<pair<long long, long long>, long long> b) {
  return (a.first.first - a.first.second) > (b.first.first - b.first.second);
}
long long solve(pair<pair<long long, long long>, long long> arr[]) {
  for (long long i = 0; i < m; i++) {
  }
  long long sumours = arr[0].first.first;
  long long sumtheirs = arr[0].first.second;
  long long i = 0;
  while (sumours >= sumtheirs) {
    i++;
    if (i >= m) break;
    sumours += arr[i].first.first;
    sumtheirs += arr[i].first.second;
  }
  return (m - i);
}
void printans(pair<pair<long long, long long>, long long> arr[]) {
  long long sumours = arr[0].first.first;
  long long sumtheirs = arr[0].first.second;
  long long i = 0;
  while (sumours >= sumtheirs) {
    i++;
    if (i >= m) break;
    sumours += arr[i].first.first;
    sumtheirs += arr[i].first.second;
  }
  for (long long j = i; j < m; j++) {
    cout << (arr[j].second + 1) << " ";
  }
  cout << endl;
}
int32_t main() {
  cin >> n >> m;
  long long vote[m][n];
  for (long long i = 0; i < m; i++) {
    for (long long j = 0; j < n; j++) {
      cin >> vote[i][j];
    }
  }
  pair<pair<long long, long long>, long long> arr[m];
  long long minsize = 1e9;
  long long minind = 0;
  for (long long i = 0; i < (n - 1); i++) {
    for (long long j = 0; j < m; j++) {
      arr[j].first.first = vote[j][i];
      arr[j].first.second = vote[j][n - 1];
      arr[j].second = j;
    }
    sort(arr, arr + m, cmp);
    long long temp = solve(arr);
    if (temp < minsize) {
      minsize = temp;
      minind = i;
    }
  }
  cout << minsize << endl;
  for (long long j = 0; j < m; j++) {
    arr[j].first.first = vote[j][minind];
    arr[j].first.second = vote[j][n - 1];
    arr[j].second = j;
  }
  sort(arr, arr + m, cmp);
  printans(arr);
}
