#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using vpll = vector<pll>;
using gr = vector<vll>;
using wgr = vector<vpll>;
struct d_ {
  template <typename T>
  d_& operator,(const T& x) {
    cerr << ' ' << x;
    return *this;
  }
  template <typename T>
  d_& operator,(const vector<T>& x) {
    for (auto x : x) cerr << ' ' << x;
    return *this;
  }
} d_t;
ll v[100][100];
int main(void) {
  ios_base::sync_with_stdio(false);
  ll n, m;
  cin >> n >> m;
  for (ll i(0); i < m; i++)
    for (ll j(0); j < n; j++) cin >> v[i][j];
  vll r;
  for (ll i(0); i < m; i++) r.push_back(i);
  for (ll i(0); i < n - 1; i++) {
    vll cur;
    ll sma = 0, smb = 0;
    for (ll j(0); j < m; j++) {
      if (v[j][i] < v[j][n - 1]) cur.push_back(j);
      sma += v[j][i];
      smb += v[j][n - 1];
    }
    sort(begin(cur), end(cur), [&](ll a, ll b) {
      ll va = v[a][i] - v[a][n - 1];
      ll vb = v[b][i] - v[b][n - 1];
      return va < vb;
    });
    vll curr;
    for (auto j : cur) {
      if (sma >= smb) break;
      sma -= v[j][i];
      smb -= v[j][n - 1];
      curr.push_back(j);
    }
    if (r.size() > curr.size()) r = curr;
  }
  cout << r.size() << endl;
  for (auto i : r) cout << i + 1 << ' ';
  cout << endl;
  return 0;
}
