#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> m >> n;
  vector<vector<int>> mat(m - 1, vector<int>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m - 1; j++) {
      cin >> mat[j][i];
    }
    int x;
    cin >> x;
    for (int j = 0; j < m - 1; j++) {
      mat[j][i] -= x;
    }
  }
  vector<int> res(1000);
  for (auto& v : mat) {
    vector<int> ans;
    priority_queue<pair<int, int>> q;
    for (int i = 0; i < n; i++) q.emplace(-v[i], i);
    int sum = accumulate(v.begin(), v.end(), 0);
    while (not q.empty() and sum < 0) {
      auto [x, i] = q.top();
      q.pop();
      ans.push_back(i);
      sum += x;
    }
    if (res.size() > ans.size()) res = move(ans);
  }
  cout << res.size() << '\n';
  for (const int e : res) cout << e + 1 << ' ';
  cout << '\n';
}
