#include <bits/stdc++.h>
using namespace std;
bool compare(const vector<int>& a, const vector<int>& b) { return a[0] < b[0]; }
void opt(vector<vector<vector<int> > >& polls, int& removed, vector<int>& idx,
         int j) {
  sort(polls[j].begin(), polls[j].end(), compare);
  int sum = 0;
  for (int i = 0; i < polls[j].size(); i++) {
    sum += polls[j][i][0];
  }
  for (int i = 0; i < polls[j].size(); i++) {
    if (sum >= 0) return;
    sum -= polls[j][i][0];
    idx.push_back(polls[j][i][1]);
    removed++;
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<vector<int> > > polls(n,
                                      vector<vector<int> >(m, vector<int>(2)));
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++) {
      cin >> polls[j][i][0];
      polls[j][i][1] = i + 1;
    }
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n - 1; j++) polls[j][i][0] -= polls[n - 1][i][0];
  int min = m + 1;
  vector<int> index;
  for (int j = 0; j < n - 1; j++) {
    int removed = 0;
    vector<int> idx;
    opt(polls, removed, idx, j);
    if (removed < min) {
      min = removed;
      index = idx;
    }
  }
  cout << min << endl;
  for (int i = 0; i < index.size(); i++) {
    if (i == 0)
      cout << index[0];
    else
      cout << ' ' << index[i];
  }
  cout << endl;
}
