#include <bits/stdc++.h>
using namespace std;
long long int n, m;
void solve() {
  cin >> n >> m;
  vector<vector<long long int>> v(m, vector<long long int>(n));
  vector<long long int> sum(n);
  for (long long int i = 0; i < (m); i++) {
    for (long long int j = 0; j < (n); j++) {
      cin >> v[i][j];
    }
  }
  vector<long long int> ans(m);
  for (long long int i = 1; i < (m + 1); i++) ans[i - 1] = i;
  for (long long int i = 0; i < (n - 1); i++) {
    vector<pair<long long int, long long int>> p(m);
    long long int diff = 0;
    for (long long int j = 0; j < (m); j++) {
      p[j] = make_pair(v[j][i] - v[j][n - 1], j);
      diff += p[j].first;
    }
    sort((p).begin(), (p).end());
    vector<long long int> newans;
    for (long long int w = 0; w < (m); w++) {
      if (diff >= 0) break;
      newans.push_back(p[w].second + 1);
      diff -= p[w].first;
    }
    if (newans.size() < ans.size()) {
      ans = newans;
    }
  }
  cout << ans.size() << endl;
  for (long long int x : ans) {
    cout << x << " ";
  }
  cout << endl;
}
int main() {
  long long int t;
  t = 1;
  while (t--) {
    solve();
  }
}
