#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = 1e18;
const int N = 2 * 1e5 + 10;
ll res;
ll a[N];
vector<ll> v[N], nero;
ll get(ll x, ll n) {
  ll cand = 0, oppo = 0, cur, ans = 0;
  vector<pair<ll, ll> > vv;
  for (int i = 0; i < v[x].size(); ++i) {
    cur = v[n][i] - v[x][i];
    if (cur > 0) vv.push_back({cur, i + 1});
    cand += v[x][i];
    oppo += v[n][i];
  }
  cur = 0;
  sort(vv.rbegin(), vv.rend());
  while (cand < oppo) {
    if (cur == vv.size()) return inf;
    nero.push_back(vv[cur].second);
    cand += vv[cur++].first;
    ++ans;
  }
  return ans;
}
void solve() {
  ll n, m, x;
  cin >> n >> m;
  for (int j = 0; j < m; ++j) {
    for (int i = 1; i <= n; ++i) {
      cin >> x;
      v[i].push_back(x);
    }
  }
  res = inf;
  for (int i = 1; i < n; ++i) {
    res = min(res, get(i, n));
    nero.clear();
  }
  cout << res << "\n";
  for (int i = 1; i < n; ++i) {
    if (res == get(i, n)) {
      for (auto i : nero) cout << i << " ";
      return;
    }
    nero.clear();
  }
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ll t = 1;
  while (t--) {
    solve();
  }
}
