#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> votes(m, vector<int>(n));
  vector<int> sum(n);
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> votes[i][j];
      sum[j] += votes[i][j];
    }
  }
  long long int minpolls = m;
  vector<int> final(m);
  for (int i = 0; i < m; ++i) final[i] = m - i - 1;
  for (int i = 0; i < n - 1; ++i) {
    vector<pair<int, int>> diff(m);
    for (int j = 0; j < m; ++j) {
      diff[j].first = votes[j][i] - votes[j][n - 1];
      diff[j].second = j;
    }
    sort(diff.begin(), diff.end());
    int k = 0;
    int ival, cval;
    ival = sum[i];
    cval = sum[n - 1];
    while (k < m) {
      if (diff[k].first >= 0 || ival >= cval) break;
      ival -= votes[diff[k].second][i];
      cval -= votes[diff[k].second][n - 1];
      k++;
    }
    if (minpolls > k) {
      minpolls = k;
      for (int pos = 0; pos < minpolls; ++pos) final[pos] = diff[pos].second;
    }
  }
  cout << minpolls << "\n";
  for (int i = 0; i < minpolls; ++i) cout << final[i] + 1 << " ";
  cout << "\n";
}
