#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, r, v, count;
  cin >> n >> m;
  vector<int> k[n];
  vector<int> a;
  for (i = 0; i < n; i++) {
    cin >> r;
    for (j = 0; j < r; j++) {
      cin >> v;
      k[i].push_back(v);
    }
  }
  for (i = 0; i < n; i++) {
    for (vector<int>::iterator it = k[i].begin(); it != k[i].end(); ++it) {
      if (m > *it) {
        a.push_back(i + 1);
        it = k[i].end();
        break;
      }
    }
  }
  cout << a.size() << endl;
  for (vector<int>::iterator it = a.begin(); it != a.end(); ++it) {
    cout << *it << " ";
  }
  return 0;
}
