#include <bits/stdc++.h>
using namespace std;
long long v[101][101];
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    for (long long j = 0; j < n; j++) {
      cin >> v[j][i];
    }
  }
  vector<pair<long long, long long> > del(m);
  vector<long long> ans(m);
  for (long long i = 0; i < m; i++) ans[i] = i + 1;
  for (long long i = 0; i + 1 < n; i++) {
    for (long long j = 0; j < m; j++) {
      del[j].first = v[i][j] - v[n - 1][j];
      del[j].second = j + 1;
    }
    sort(del.rbegin(), del.rend());
    long long diff = 0;
    long long j = 0;
    for (j = 0; j < m; j++) {
      diff += del[j].first;
      if (diff < 0) break;
    }
    if (m - j < ans.size()) {
      long long idx = 0;
      for (; j < m; j++) ans[idx++] = del[j].second;
      ans.resize(idx);
    }
  }
  cout << ans.size() << "\n";
  for (long long i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  return 0;
}
