#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
long long int a[107][107];
vector<long long int> temp;
bool custom(pair<long long int, long long int> &a,
            pair<long long int, long long int> &b) {
  return a.first > b.first;
}
void doit(long long int x, long long int m, long long int n) {
  vector<pair<long long int, long long int> > v;
  long long int tx = 0, tn = 0;
  for (long long int i = 0; i < m; i++) {
    tx += a[i][x];
    tn += a[i][n - 1];
    v.push_back({a[i][n - 1] - a[i][x], i + 1});
  }
  sort(v.begin(), v.end(), custom);
  long long int diff = tn - tx;
  if (diff <= 0) {
    return;
  }
  for (long long int i = 0; i < m; i++) {
    diff -= v[i].first;
    temp.push_back(v[i].second);
    if (diff <= 0) return;
  }
}
void solve() {
  long long int n, m;
  cin >> n >> m;
  for (long long int i = 0; i < m; i++) {
    for (long long int j = 0; j < n; j++) cin >> a[i][j];
  }
  vector<long long int> ans(m);
  for (long long int i = 0; i < m; i++) ans[i] = i + 1;
  for (long long int i = 0; i < n - 1; i++) {
    temp.clear();
    doit(i, m, n);
    if (temp.size() < ans.size()) {
      ans = temp;
    }
  }
  cout << ans.size() << "\n";
  for (auto x : ans) cout << x << " ";
  cout << "\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  clock_t launch = clock();
  while (t--) {
    solve();
  }
  clog << ((long double)(clock() - launch) / CLOCKS_PER_SEC) << "\n";
}
