#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-1;
const double PI = acos(-1.0);
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cout.precision(10);
  cout << fixed;
  int n, m;
  cin >> n >> m;
  int a[m + 1][n + 1];
  for (int i = 1; i <= (int)m; ++i) {
    for (int j = 1; j <= (int)n; ++j) {
      cin >> a[i][j];
    }
  }
  pair<int, int> f[n + 1];
  int kc;
  vector<int> res(m + 1, 0);
  for (int i = 1; i <= (int)n - 1; ++i) {
    vector<int> cur;
    kc = 0;
    for (int j = 1; j <= (int)m; ++j) {
      f[j] = {a[j][i] - a[j][n], j};
      kc += a[j][n] - a[j][i];
    }
    sort(f + 1, f + m + 1);
    for (int j = 1; j <= (int)m; ++j) {
      if (kc > 0) {
        kc += f[j].first;
        cur.push_back(f[j].second);
      } else
        break;
    }
    if (cur.size() < res.size()) res = cur;
  }
  cout << res.size() << '\n';
  for (int i = 0; i < (int)res.size(); ++i) {
    cout << res[i] << ' ';
  }
  return 0;
}
