#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, i, j, idx, min1 = 1e14, val;
  cin >> n >> m;
  long long ar[m + 1][n + 1];
  long long arr[m + 1], brr[m + 1];
  for (j = 1; j <= m; j++) {
    for (i = 1; i <= n; i++) {
      cin >> ar[j][i];
    }
  }
  for (i = 1; i <= m; i++) {
    brr[i] = ar[i][n];
  }
  vector<pair<long long, long long> > vec;
  for (i = 1; i < n; i++) {
    vec.clear();
    for (j = 1; j <= m; j++) {
      arr[j] = ar[j][i];
      vec.push_back({-arr[j] + brr[j], j});
    }
    sort(vec.begin(), vec.end());
    long long s = 0, s1 = 0;
    for (j = 0; j < vec.size(); j++) {
      s += ((vec[j].first));
      if (s > 0) break;
      s1++;
    }
    if (min1 > (m - s1)) {
      idx = i;
      val = j;
      min1 = min(min1, m - s1);
    }
  }
  cout << min1 << "\n";
  vec.clear();
  for (j = 1; j <= m; j++) {
    arr[j] = ar[j][idx];
    vec.push_back({-arr[j] + brr[j], j});
  }
  sort(vec.begin(), vec.end());
  for (i = val; i < vec.size(); i++) cout << vec[i].second << " ";
}
