#include <bits/stdc++.h>
using namespace std;
const bool debug = 0;
int main() {
  if (!debug) {
    cin.tie(0);
    cin.sync_with_stdio(0);
    cout.tie(0);
    cout.sync_with_stdio(0);
  }
  int n, m;
  cin >> n >> m;
  vector<vector<int>> d(m, vector<int>(n));
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++) cin >> d[i][j];
  vector<int> out(m);
  for (int i = 0; i < m; i++) out[i] = i;
  for (int v = 0; v < n - 1; v++) {
    vector<pair<int, int>> k(m);
    int r = 0;
    for (int i = 0; i < m; i++) {
      k[i] = {d[i][n - 1] - d[i][v], i};
      r += k[i].first;
    }
    sort(k.begin(), k.end());
    reverse(k.begin(), k.end());
    if (debug)
      for (int i = 0; i < m; i++)
        cout << k[i].first << ':' << k[i].second << ' ';
    if (debug) cout << '\n' << r << '\n';
    int i = 0;
    for (; i < m; i++) {
      if (r > 0)
        r -= k[i].first;
      else
        break;
    }
    if (r <= 0 && out.size() > i) {
      out.resize(i);
      for (int j = 0; j < i; j++) out[j] = k[j].second;
    }
  }
  cout << out.size() << '\n';
  for (int i = 0; i < out.size(); i++) cout << out[i] + 1 << ' ';
  return 0;
}
