/**
 * Author: Sergey Kopeliovich (Burunduk30@gmail.com5
 * Date: 2013.10.04
 *
 * Status: Accepted, Time = 0.3
 */

#include <cstdio>
#include <cmath>
#include <cassert>
#include <cstring>
#include <algorithm>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;
typedef long double dbl;

const ll P = (int)1e9 + 7;
const int N = 1000;
const int D = 10;
const dbl eps = 1e-11;

int n, d, a[N][D];
int pn, p[N];      
int rn, rp[N];

int cn, id[3], ind[N], o[N];
dbl c[N][D], b[D];

inline bool vless( int i, int j )
{
  forn(k, d)
    if (fabs(c[i][k] - c[j][k]) > eps)
      return c[i][k] < c[j][k];
  return 0; 
}

int main()
{
  #define NAME "subset"
  assert(freopen(NAME ".in", "r", stdin));
  assert(freopen(NAME ".out", "w", stdout));

  assert(scanf("%d%d", &n, &d) == 2 && n <= N && d <= D);
  forn(i, n)
    forn(j, d)
      assert(scanf("%d", &a[i][j]) == 1);
  forn(i, n)
  {
    pn = cn = 0;

    int pos = 0;
    while (!a[i][pos])
      pos++;
    forn(j, i)
    {
      int good = 1;
      forn(k, d)
        b[k] = a[j][k];
      if (a[j][pos])
      {
        dbl koef = (dbl)a[j][pos] / a[i][pos];
        good = 0;
        forn(k, d)
          if (fabs(b[k] -= koef * a[i][k]) > eps)
            good = 1;
      }
      if (!good)
        p[pn++] = j;
      else
      {
        int id = 0;
        while (fabs(b[id]) < eps)
          id++;
        dbl koef = 1.0 / b[id];
        forn(k, d)
          b[k] *= koef;
        memcpy(c[cn], b, sizeof(b));
        o[cn] = cn, ind[cn++] = j;
      }
    }
    sort(o, o + cn, vless);

    int ma = 0, rj = 0;
    for (int j = 0, k; j < cn; j = k)
    {
      for (k = j + 1; k < cn && !vless(o[j], o[k]); k++)
        ;
      if (k - j > ma)
        ma = k - j, rj = j;
    }
    if (ma + pn + 1 > rn)
    {
      rn = ma + pn + 1;
      forn(j, pn)
        rp[j] = p[j];
      forn(j, ma)
        rp[j + pn] = ind[o[rj + j]];
      rp[ma + pn] = i;
    }
  }
  printf("%d\n", rn);
  forn(i, rn)
    printf("%d%c", rp[i] + 1, " \n"[i == rn - 1]);
  return 0;
}
