#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
long long int mul(long long int x, long long int y) {
  return (x * 1ll * y) % mod;
}
long long int add(long long int x, long long int y) {
  x += y;
  while (x >= mod) x -= mod;
  while (x < 0) x += mod;
  return x;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n, m;
  cin >> n >> m;
  long long int a[m][n];
  long long int p[n];
  memset(p, 0, sizeof(p));
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
      p[j] += a[i][j];
    }
  }
  for (int i = 0; i < n - 1; i++) {
    if (p[i] >= p[n - 1]) {
      cout << 0 << endl;
      return 0;
    }
  }
  vector<int> pi;
  long long int mi = 1e18;
  for (int i = n - 2; i >= 0; i--) {
    vector<long long int> v;
    long long int vis[m];
    memset(vis, 0, sizeof(vis));
    long long int sum = 0;
    for (int j = 0; j < m; j++) {
      int f = m;
      long long int o = 0;
      for (int k = 0; k < m; k++) {
        if (!vis[k]) {
          if (o < a[k][n - 1] - a[k][i]) {
            f = k;
            o = a[k][n - 1] - a[k][i];
          }
        }
      }
      vis[f] = 1;
      p[i] -= a[f][i];
      sum += a[f][n - 1];
      v.push_back(f + 1);
      if (p[n - 1] - sum <= p[i]) break;
    }
    if (v.size() < mi) {
      mi = v.size();
      pi.clear();
      for (int i = 0; i < mi; i++) {
        pi.push_back(v[i]);
      }
    }
  }
  cout << pi.size() << endl;
  for (int i = 0; i < pi.size(); i++) {
    cout << pi[i] << " ";
  }
  cout << endl;
}
