#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using pa = pair<int, int>;
using str = string;
ll lmax(ll a, ll b) { return a > b ? a : b; }
ll lmin(ll a, ll b) { return a < b ? a : b; }
void fileio(str p) {
  freopen((p + ".in").c_str(), "r", stdin);
  freopen((p + ".out").c_str(), "w", stdout);
}
int tmp, ta, tb;
int main() {
  cin.tie(0)->sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<vector<int>> arr(M, vector<int>(N));
  for (auto& v : arr) {
    for (auto& e : v) {
      cin >> e;
    }
  }
  for (auto& v : arr) {
    for (int i = 0; i < N; i++) {
      v[i] = v.back() - v[i];
    }
    v.resize(v.size() - 1);
  }
  ll ans = 1e12;
  vector<int> r;
  vector<int> r_res;
  r.reserve(M);
  for (int i = 0; i < N - 1; i++) {
    r.clear();
    ll cnt = 0, sum = 0;
    vector<pa> s(M);
    for (int j = 0; j < M; j++) {
      s[j] = {arr[j][i], j};
      sum += s[j].first;
    }
    sort(s.begin(), s.end(), greater<pa>());
    int idx = 0;
    while (idx < M && sum > 0) {
      r.push_back(s[idx].second);
      sum -= s[idx++].first;
    }
    cnt = idx;
    if (cnt < ans) {
      ans = cnt;
      r_res = r;
    }
  }
  cout << ans << endl;
  for (auto& e : r_res) cout << e + 1 << " ";
  cout << endl;
}
