#include <bits/stdc++.h>
#pragma GCC optimization("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,sse4,mmx")
using namespace std;
const int inf = 1e9 + 7;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  ofstream fout("debug");
  int n, m;
  cin >> n >> m;
  int A[m][n];
  vector<int> O;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      cin >> A[i][j];
    }
    O.push_back(i);
  }
  for (int i = 0; i < n - 1; i++) {
    vector<pair<int, int> > R(m);
    for (int j = 0; j < m; j++) {
      R[j] = {A[j][i] - A[j][n - 1], j};
    }
    sort(R.rbegin(), R.rend());
    vector<bool> V(m, 0);
    int sum = 0, ess = 0;
    for (int j = 0; j < m; j++) {
      sum += R[j].first;
      if (sum < 0) break;
      if (V[R[j].second] == 0) ess++;
      V[R[j].second] = 1;
    }
    ess = m - ess;
    if (ess < O.size()) {
      O.clear();
      for (int j = 0; j < m; j++) {
        if (V[j] == 0) O.push_back(j);
      }
    }
  }
  cout << O.size() << '\n';
  for (int i = 0; i < O.size(); i++) {
    cout << O[i] + 1 << ' ';
  }
  cout << '\n';
  return 0;
}
