#include <bits/stdc++.h>
using namespace std;
template <typename Arg1, typename Arg2>
ostream& operator<<(ostream& out, const pair<Arg1, Arg2>& x) {
  return out << "(" << x.first << "," << x.second << ")";
}
template <typename Arg1>
ostream& operator<<(ostream& out, const vector<Arg1>& a) {
  out << "[";
  for (const auto& x : a) out << x << ",";
  return out << "]";
}
template <typename Arg1>
ostream& operator<<(ostream& out, const set<Arg1>& a) {
  out << "[";
  for (const auto& x : a) out << x << ",";
  return out << "]";
}
template <typename Arg1, typename Arg2>
ostream& operator<<(ostream& out, const map<Arg1, Arg2>& a) {
  out << "[";
  for (const auto& x : a) out << x << ",";
  return out << "]";
}
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << " ] " << endl;
}
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args) {
  const string name = names.substr(0, names.find(','));
  cerr << name << " : " << arg1 << " | ";
  __trace__(names.substr(1 + (int)name.size()), args...);
}
clock_t time_p = clock();
void time_taken() {
  time_p = clock() - time_p;
  cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
const long long mod = 1e9 + 7;
const long long INF = 1e18;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.precision(12);
  cout << fixed;
  int n, m;
  cin >> n >> m;
  vector<vector<int>> a(m, vector<int>(n));
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  long long ans = m;
  vector<int> res(m);
  iota(res.begin(), res.end(), 0);
  for (int i = 0; i < n - 1; i++) {
    vector<pair<long long, long long>> v;
    long long sum = 0;
    for (int j = 0; j < m; j++) {
      v.push_back({a[j][i] - a[j][n - 1], j});
      sum += v.back().first;
    }
    if (sum >= 0) {
      ans = 0;
      res.clear();
      break;
    }
    vector<int> cur;
    int cnt = 0;
    sort(v.begin(), v.end());
    for (int j = 0; j < (int)v.size(); j++) {
      sum -= v[j].first;
      cnt++;
      cur.push_back(v[j].second);
      if (sum >= 0) break;
    }
    if (cnt < ans) {
      ans = cnt;
      res = cur;
    }
  }
  cout << ans << '\n';
  for (int i = 0; i < ans; i++) {
    cout << res[i] + 1 << " ";
  }
  cout << '\n';
  time_taken();
  return 0;
}
