#include <bits/stdc++.h>
using namespace std;
void solve(long long tz) {
  int n, m;
  cin >> m >> n;
  int A[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> A[i][j];
    }
  }
  vector<int> arr;
  for (int i = 0; i < m; i++) {
    int sum = 0;
    for (int j = 0; j < n; j++) {
      sum += A[j][i];
    }
    arr.push_back(sum);
  }
  for (int i = 0; i < m - 1; i++) {
    if (arr[i] >= arr[m - 1]) {
      cout << 0 << endl;
      return;
    }
  }
  vector<vector<int>> diff;
  for (int i = 0; i < n; i++) {
    vector<int> curr;
    for (int j = 0; j < m - 1; j++) {
      curr.push_back(A[i][m - 1] - A[i][j]);
    }
    diff.push_back(curr);
  }
  vector<vector<pair<int, int>>> ans;
  for (int i = 0; i < m - 1; i++) {
    vector<pair<int, int>> now;
    for (int j = 0; j < n; j++) {
      now.push_back({diff[j][i], j + 1});
    }
    sort(now.begin(), now.end());
    ans.push_back(now);
  }
  vector<int> res;
  bool find = false;
  int mini = INT_MAX;
  for (int i = 0; i < ans.size(); i++) {
    int req = arr[m - 1] - arr[i];
    int cnt = 0;
    vector<int> curr_res;
    for (int j = ans[i].size() - 1; j >= 0; j--) {
      req -= ans[i][j].first;
      curr_res.push_back(ans[i][j].second);
      if (req <= 0) {
        break;
      }
    }
    if (curr_res.size() < mini) {
      res.clear();
      res = curr_res;
      mini = curr_res.size();
    }
  }
  cout << mini << endl;
  for (int i = 0; i < res.size(); i++) {
    cout << res[i] << " ";
  }
}
int main() {
  long long t;
  t = 1;
  long long z = 0;
  while (t--) {
    z++;
    solve(z);
  }
}
