#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
int a[100][100];
void solve() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> a[i][j];
    }
  }
  int ans = n + 1;
  int chk = n;
  for (int i = 0; i < n - 1; ++i) {
    vector<int> d(m);
    int sum = 0;
    for (int j = 0; j < m; ++j) {
      d[j] = a[j][i] - a[j][n - 1];
      sum += d[j];
    }
    sort(d.begin(), d.end());
    int tmp = 0;
    for (int j = 0; j < m; ++j) {
      if (sum >= 0) break;
      sum -= d[j];
      tmp++;
    }
    if (ans > tmp) {
      ans = tmp;
      chk = i;
    }
  }
  vector<P> d(m);
  int sum = 0;
  for (int j = 0; j < m; ++j) {
    d[j] = {a[j][chk] - a[j][n - 1], j + 1};
    sum += d[j].first;
  }
  sort(d.begin(), d.end());
  vector<int> ers;
  for (int j = 0; j < m; ++j) {
    if (sum >= 0) break;
    sum -= d[j].first;
    ers.push_back(d[j].second);
  }
  cout << ers.size() << endl;
  for (int i = 0; i < ers.size(); ++i) {
    if (i > 0) cout << " ";
    cout << ers[i];
  }
  cout << endl;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
