#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[m][n];
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  int index = -1;
  int maxi = -1;
  for (int i = 0; i < n - 1; i++) {
    vector<pair<int, int>> v;
    for (int j = 0; j < m; j++) {
      v.push_back({a[j][i] - a[j][n - 1], j});
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    int sum = 0;
    int val = -1;
    for (int j = 0; j < m; j++) {
      sum += v[j].first;
      if (sum < 0) {
        val = j;
        break;
      }
    }
    if (val == -1) {
      cout << 0 << endl;
      return 0;
    }
    if (val > maxi) {
      maxi = val;
      index = i;
    }
  }
  vector<pair<int, int>> v;
  for (int i = 0; i < m; i++) {
    v.push_back({a[i][index] - a[i][n - 1], i + 1});
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  int sum = 0;
  int val = -1;
  for (int j = 0; j < m; j++) {
    sum += v[j].first;
    if (sum < 0) {
      val = j;
      break;
    }
  }
  vector<int> final;
  for (int i = val; i < m; i++) {
    final.push_back(v[i].second);
  }
  cout << final.size() << endl;
  for (auto u : final) {
    cout << u << " ";
  }
  return 0;
}
