#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, answer = 0;
  cin >> n >> m;
  int mn = m;
  int a[m][n];
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++) cin >> a[i][j];
  for (int i = 0; i < n - 1; i++) {
    vector<int> vec;
    int ans = 0;
    for (int j = 0; j < m; j++) {
      ans += a[j][i] - a[j][n - 1];
      vec.push_back(a[j][i] - a[j][n - 1]);
    }
    sort(vec.begin(), vec.end());
    int cnt = 0;
    for (int x : vec) {
      if (ans >= 0)
        if (mn > cnt) {
          mn = cnt;
          answer = i;
        }
      ans -= x;
      cnt++;
    }
  }
  vector<pair<int, int> > vec;
  int i = answer;
  for (int j = 0; j < m; j++) {
    vec.push_back({a[j][i] - a[j][n - 1], j});
  }
  sort(vec.begin(), vec.end());
  cout << mn << endl;
  for (int i = 0; i < mn; i++) cout << vec[i].second + 1 << ' ';
}
