#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  while (cin >> n >> m) {
    vector<vector<pair<int, int>>> arr(n, vector<pair<int, int>>(m));
    vector<int> ex(n - 1, 0);
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < n; j++) {
        cin >> arr[j][i].first;
        arr[j][i].second = i + 1;
      }
      for (int j = 0; j < n - 1; j++) {
        arr[j][i].first = arr[j][i].first - arr[n - 1][i].first;
        ex[j] += arr[j][i].first;
      }
    }
    int res = m;
    vector<int> ans(m);
    for (int i = 0; i < m; i++) {
      ans[i] = i + 1;
    }
    for (int i = 0; i < n - 1; i++) {
      if (ex[i] >= 0) {
        res = 0;
        ans = {};
        break;
      }
      sort(arr[i].begin(), arr[i].end());
      if (arr[i].back().first >= 0) {
        vector<int> temp;
        int cnt = 0;
        int j = 0;
        while (arr[i][j].first < 0) {
          ex[i] -= arr[i][j].first;
          temp.push_back(arr[i][j].second);
          cnt++;
          if (ex[i] >= 0) {
            if (cnt < res) {
              res = cnt;
              ans = temp;
            }
            break;
          }
          j++;
        }
      }
    }
    cout << res << endl;
    for (auto p : ans) {
      cout << p << ' ';
    }
    cout << endl;
  }
  return 0;
}
