#include <bits/stdc++.h>
using namespace std;
long long Pow(long long x, long long y, long long m) {
  if (y == 0) return 1;
  long long p = Pow(x, y / 2, m) % m;
  p = (p * p) % m;
  return (y % 2 == 0) ? p : (x * p) % m;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long i, j;
  long long n, m, idx = -1;
  cin >> n >> m;
  long long mn = m + 1;
  vector<pair<long long, long long> > v[n];
  vector<long long> diff(n);
  for (i = 0; i < m; i++) {
    vector<long long> a(n);
    for (j = 0; j < n; j++) cin >> a[j];
    for (j = 0; j < n - 1; j++) {
      v[j].push_back({a[n - 1] - a[j], i});
      diff[j] += a[n - 1] - a[j];
    }
  }
  for (i = 0; i < n; i++)
    sort(v[i].begin(), v[i].end(), greater<pair<long long, long long> >());
  for (i = 0; i < n - 1; i++) {
    for (j = 0; j < m; j++) {
      if (diff[i] <= 0)
        break;
      else
        diff[i] -= v[i][j].first;
    }
    if (j < mn) mn = j, idx = i;
  }
  cout << mn << "\n";
  for (i = 0; i < mn; i++) cout << v[idx][i].second + 1 << " ";
  cout << "\n";
}
