#include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")
using namespace std;
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<vector<pair<int, int> > > diff(n, vector<pair<int, int> >(m));
  for (int j = 0; j < (m); j++) {
    for (int i = 0; i < (n); i++) {
      cin >> diff[i][j].first;
    }
  }
  vector<int> ans(m + 1, -1);
  for (int i = 0; i < (n - 1); i++) {
    int tot_diff = 0;
    for (int j = 0; j < (m); j++) {
      diff[i][j].first -= diff[n - 1][j].first;
      diff[i][j].second = j;
      tot_diff += diff[i][j].first;
    }
    sort(diff[i].begin(), diff[i].end());
    vector<int> cur;
    for (int j = 0; j < m && tot_diff < 0; j++) {
      cur.push_back(diff[i][j].second);
      tot_diff -= diff[i][j].first;
    }
    if (ans.size() > cur.size()) {
      ans.clear();
      ans = vector<int>(cur);
    }
  }
  cout << ans.size() << '\n';
  for (int a : ans) {
    cout << a + 1 << ' ';
  }
  cout << '\n';
}
