#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> data(m, vector<int>(n));
  for (auto &v : data)
    for (auto &x : v) cin >> x;
  vector<int> best(m + 1, -1);
  for (int i = 0; i < n - 1; i++) {
    int sum = 0, sum_he = 0;
    vector<pair<int, int>> tmp;
    for (int j = 0; j < m; j++) {
      sum += data[j][i];
      sum_he += data[j][n - 1];
      tmp.emplace_back(data[j][n - 1] - data[j][i], j);
    }
    sort(begin(tmp), end(tmp));
    vector<int> res;
    while (sum < sum_he) {
      auto [_, j] = tmp.back();
      tmp.pop_back();
      sum -= data[j][i];
      sum_he -= data[j][n - 1];
      res.push_back(j);
    }
    if (best.size() > res.size()) best = res;
  }
  cout << best.size() << endl;
  for (auto x : best) cout << x + 1 << " ";
  cout << endl;
}
