#include <bits/stdc++.h>
using namespace std;
struct DisjointSet {
  long long int n;
  vector<long long int> sets;
  vector<long long int> sizes;
  DisjointSet(long long int n) : n(n), sets(n), sizes(n) {
    for (long long int i = 0; i < n; i++) {
      sets[i] = i;
      sizes[i] = 1;
    }
  }
  long long int find(long long int node) {
    vector<long long int> actualizar;
    while (sets[node] != node) {
      actualizar.push_back(node);
      node = sets[node];
    }
    for (long long int hijo : actualizar) {
      sets[hijo] = node;
    }
    return node;
  }
  long long int findr(long long int node) {
    if (sets[node] != node) {
      sets[node] = findr(sets[node]);
    }
    return sets[node];
  }
  bool join(long long int first, long long int second) {
    long long int pfirst = find(first);
    long long int psecond = find(second);
    if (pfirst == psecond) return false;
    if (sizes[pfirst] < sizes[psecond]) swap(pfirst, psecond);
    sets[psecond] = sets[pfirst];
    sizes[pfirst] += sizes[psecond];
    return true;
  }
};
const long long int MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, m;
  cin >> n >> m;
  map<long long int, vector<long long int>> graph;
  set<long long int> nodes;
  DisjointSet ds(m + 1);
  vector<long long int> s;
  for (long long int i = 0; i < n; i++) {
    long long int nums;
    long long int from;
    long long int to;
    cin >> nums >> from;
    if (nums == 1) {
      to = 0;
    } else {
      cin >> to;
    }
    nodes.insert(from);
    nodes.insert(to);
    if (ds.find(from) != ds.find(to)) {
      s.push_back(i + 1);
    }
    ds.join(from, to);
  }
  long long int aristas = 0;
  vector<long long int> nodes_per_set(m + 1, 0);
  for (long long int i = 0; i <= m; i++) {
    nodes_per_set[ds.find(i)]++;
  }
  for (long long int i = 0; i <= m; i++) {
    if (nodes_per_set[i] >= 1) {
      aristas += nodes_per_set[i] - 1;
    }
  }
  long long int total = 1;
  for (long long int i = 0; i < aristas; i++) {
    total *= 2;
  }
  cout << total << " " << s.size() << '\n';
  for (long long int num : s) {
    cout << num << " ";
  }
  cout << '\n';
}
