#include <bits/stdc++.h>
using namespace std;
bool sortcol(const vector<long long int>& v1, const vector<long long int>& v2) {
  if (v1[0] == v2[0]) return v1[1] < v2[1];
  return v1[0] < v2[0];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  vector<vector<long long int> > A(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 >> A[i][j];
  for (long long int i = 0; i < m; i++) {
    for (long long int j = 0; j < n - 1; j++) A[i][j] = A[i][n - 1] - A[i][j];
    A[i][n - 1] = i;
  }
  long long int max = 0, store = -1;
  for (long long int i = 0; i < n - 1; i++) {
    vector<vector<long long int> > B(m, vector<long long int>(2));
    for (long long int j = 0; j < m; j++) {
      B[j][0] = A[j][i];
      B[j][1] = A[j][n - 1];
    }
    sort(B.begin(), B.end(), sortcol);
    long long int ans = 0, val = 0, check = 0;
    for (long long int j = 0; j < m; j++) {
      ans += B[j][0];
      if (ans > 0) {
        val = j;
        if (val > max) {
          max = val;
          store = i;
        }
        check = 1;
        break;
      }
    }
    if (check == 1) continue;
    val = m;
    if (val > max) {
      max = val;
      store = i;
    }
  }
  cout << m - max << endl;
  vector<vector<long long int> > B(m, vector<long long int>(2));
  for (long long int j = 0; j < m; j++) {
    B[j][0] = A[j][store];
    B[j][1] = A[j][n - 1];
  }
  sort(B.begin(), B.end(), sortcol);
  for (long long int i = max; i < m; i++) cout << B[i][1] + 1 << " ";
  return 0;
}
