#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];
    }
  }
  vector<pair<int, int> > dif[n];
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < m; j++) {
      dif[i].push_back({a[j][i] - a[j][n - 1], j});
    }
    sort(dif[i].begin(), dif[i].end());
  }
  int maxi = INT_MIN;
  int pos = -1;
  for (int i = 0; i < n - 1; i++) {
    int sum = 0;
    int cnt = 0;
    for (int j = dif[i].size() - 1; j >= 0; j--) {
      if (sum + dif[i][j].first < 0) {
        break;
      }
      sum += dif[i][j].first;
      cnt++;
    }
    if (cnt > maxi) {
      maxi = cnt;
      pos = i;
    }
  }
  bool usa[m];
  memset(usa, 0, sizeof usa);
  int sz = dif[pos].size() - 1;
  for (int i = 0; i < maxi; i++) {
    usa[dif[pos][sz - i].second] = true;
  }
  vector<int> ans;
  for (int i = 0; i < m; i++) {
    if (!usa[i]) ans.push_back(i + 1);
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}
