#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> v(n, vector<int>(m));
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> v[j][i];
    }
  }
  vector<int> ans;
  for (int i = 0; i < m; ++i) {
    ans.push_back(i);
  }
  for (int i = 0; i < n - 1; ++i) {
    vector<pair<int, int>> dist;
    int sum = 0;
    for (int j = 0; j < m; ++j) {
      dist.push_back({v[n - 1][j] - v[i][j], j});
      sum += (v[n - 1][j] - v[i][j]);
    }
    sort(dist.begin(), dist.end());
    vector<int> buf;
    while (sum > 0) {
      sum -= dist.back().first;
      buf.push_back(dist.back().second);
      dist.pop_back();
    }
    if (ans.size() > buf.size()) {
      ans.clear();
      ans = buf;
    }
  }
  cout << ans.size() << endl;
  for (int elem : ans) {
    cout << elem + 1 << " ";
  }
  return 0;
}
