#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, ans = 10002;
  cin >> n >> m;
  vector<int> indices;
  int a[m][n];
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) cin >> a[i][j];
  }
  for (int cand = 0; cand < n - 1; ++cand) {
    int sum = 0;
    vector<pair<int, int> > v;
    for (int i = 0; i < m; ++i) {
      v.push_back(make_pair(a[i][cand] - a[i][n - 1], i + 1));
      sum += a[i][cand] - a[i][n - 1];
    }
    if (sum >= 0) {
      cout << "0";
      return 0;
    }
    sort(v.begin(), v.end());
    for (int i = 0; i < m; ++i) {
      sum -= v[i].first;
      if (sum >= 0) {
        if ((i + 1) < ans) {
          indices.clear();
          ans = i + 1;
          for (int j = 0; j <= i; ++j) indices.push_back(v[j].second);
        }
        break;
      }
    }
  }
  cout << ans << "\n";
  for (int i = 0; i < ans; ++i) cout << indices[i] << " ";
  return 0;
}
