#include <bits/stdc++.h>
using namespace std;
using LL = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename S>
using P = pair<T, S>;
template <class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
using LD = long double;
template <typename T, typename S>
void check(T& a, S& b) {
  if (a >= b) {
    a %= b;
  }
}
template <typename T>
T gcd(T u, T v) {
  if (u == v) return u;
  if (u == 0) return v;
  if (v == 0) return u;
  if (~u & 1) {
    if (v & 1)
      return gcd(u >> 1, v);
    else
      return gcd(u >> 1, v >> 1) << 1;
  }
  if (~v & 1) return gcd(u, v >> 1);
  if (u > v) return gcd((u - v) >> 1, v);
  return gcd((v - u) >> 1, u);
}
const int N = (int)1e5 + 10;
const int M = (N << 1) + 1;
V<int> G[M], Grev[M];
bool explored[M];
int leader[M], finish[M], order[M], t = 0, parent = 0;
map<int, bool> truthAssignment;
void dfs_reverse(int u) {
  explored[u] = true;
  for (auto& i : Grev[u]) {
    if (!explored[i]) {
      dfs_reverse(i);
    }
  }
  finish[u] = ++t;
}
void dfs(int u) {
  explored[u] = true;
  leader[u] = parent;
  for (auto& i : G[u]) {
    if (!explored[i]) dfs(i);
  }
}
bool stronglyConnected(int u, int v) { return leader[u] == leader[v]; }
V<V<int>> s;
void add_edge(int u, int v) {
  auto make_edge = [&](int a, int b) {
    if (a < 0) a = N - a;
    if (b < 0) b = N - b;
    G[a].push_back(b);
    Grev[b].push_back(a);
  };
  make_edge(-u, v);
  make_edge(-v, u);
}
int compare(V<int>& a, V<int>& b) {
  int n = (int)a.size(), m = (int)b.size();
  for (int i = 0; i < n && i < m; i++) {
    if (a[i] == b[i]) continue;
    if (a[i] < b[i]) {
      add_edge(a[i], -b[i]);
      return true;
    } else {
      add_edge(a[i], b[i]);
      add_edge(a[i], -b[i]);
      add_edge(-a[i], -b[i]);
      return true;
    }
  }
  return n <= m;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cerr.tie(NULL);
  ;
  int n, m;
  cin >> n >> m;
  s.resize(n);
  for (int i = 0; i < n; i++) {
    int l;
    cin >> l;
    s[i].resize(l);
    for (int j = 0; j < (int)l; j++) cin >> s[i][j];
  }
  for (int i = 0; i + 1 < n; i++) {
    if (!compare(s[i], s[i + 1])) {
      cout << "No\n";
      return 0;
    }
  }
  for (int i = N << 1; i > 0; i--) {
    if (!explored[i]) dfs_reverse(i);
    order[finish[i]] = i;
  }
  memset(explored, false, sizeof explored);
  for (int i = N << 1; i > 0; i--) {
    if (!explored[order[i]]) {
      parent = order[i];
      dfs(order[i]);
    }
  }
  for (int i = N << 1; i > 0; i--) {
    int u = order[i];
    if (u > N) {
      if (stronglyConnected(u, u - N)) {
        cout << "No\n";
        return 0;
      }
      if (truthAssignment.find(leader[u]) == truthAssignment.end()) {
        truthAssignment[leader[u]] = true;
        truthAssignment[leader[u - N]] = false;
      }
    } else {
      if (stronglyConnected(u, N + u)) {
        cout << "No\n";
        return 0;
      }
      if (truthAssignment.find(leader[u]) == truthAssignment.end()) {
        truthAssignment[leader[u]] = true;
        truthAssignment[leader[N + u]] = false;
      }
    }
  }
  cout << "Yes\n";
  V<int> ans, _ans;
  for (int i = 1; i <= m; i++) {
    if (truthAssignment[leader[i]]) ans.push_back(i);
  }
  cout << (int)ans.size() << '\n';
  for (int& i : ans) cout << i << ' ';
  return 0;
}
