#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<ld, ld>;
const int maxn = 2e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> v[m];
  for (int i = 0; i < m; i++) {
    int mx = 0;
    for (int j = 0; j < n; j++) {
      int a;
      cin >> a;
      v[i].push_back(a);
    }
  }
  int ans = mod;
  priority_queue<pii> best;
  for (int j = 0; j < n - 1; j++) {
    priority_queue<pii> pq;
    for (int i = 0; i < m; i++) pq.push({v[i][j] - v[i][n - 1], i + 1});
    int cur = 0;
    while ((int)pq.size()) {
      if (cur + pq.top().first >= 0) {
        cur += pq.top().first;
        pq.pop();
      } else
        break;
    }
    if ((int)pq.size() < ans) {
      ans = (int)pq.size();
      best = pq;
    }
  }
  cout << ans << "\n";
  while ((int)best.size()) {
    cout << best.top().second << " ";
    best.pop();
  }
  cout << "\n";
  return 0;
}
