#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
long long int a[110][110];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  vector<long long int> sums(n, 0);
  for (long long int i = 0; i < m; ++i) {
    for (long long int j = 0; j < n; ++j) {
      cin >> a[i][j];
      sums[j] += a[i][j];
    }
  }
  vector<long long int> polls;
  for (long long int i = 0; i < m; ++i) polls.push_back(i);
  vector<long long int> best;
  long long int smol = m + 1;
  for (long long int can = 0; can < n - 1; ++can) {
    sort(polls.begin(), polls.end(), [&](long long int x, long long int y) {
      return a[x][can] - a[x][n - 1] < a[y][can] - a[y][n - 1];
    });
    long long int cs = sums[can];
    long long int bsum = sums[n - 1];
    vector<long long int> kk;
    long long int i = 0;
    while (bsum > cs) {
      kk.push_back(polls[i]);
      cs -= a[polls[i]][can];
      bsum -= a[polls[i]][n - 1];
      i++;
    }
    if (kk.size() < smol) {
      smol = kk.size();
      best = kk;
    }
  }
  cout << smol << endl;
  for (auto a : best) cout << (a + 1) << " ";
  cout << endl;
}
