#include <bits/stdc++.h>
using namespace std;
struct TwoSat {
  int N;
  vector<vector<int> > gr;
  vector<int> values;
  TwoSat(int n = 0) : N(n), gr(2 * n) {}
  int add_var() {
    gr.emplace_back();
    gr.emplace_back();
    return N++;
  }
  void add_clause(int f, int j) {
    f = (f >= 0 ? 2 * f : -1 - 2 * f);
    j = (j >= 0 ? 2 * j : -1 - 2 * j);
    gr[f ^ 1].push_back(j);
    gr[j ^ 1].push_back(f);
  }
  void set_value(int x) { add_clause(x, x); }
  void at_most_one(const vector<int>& li) {
    if ((int)(li).size() <= 1) return;
    int cur = ~li[0];
    for (int i = 2; i < ((int)(li).size()); ++i) {
      int next = add_var();
      add_clause(cur, ~li[i]);
      add_clause(cur, next);
      add_clause(~li[i], next);
      cur = ~next;
    }
    add_clause(cur, ~li[1]);
  }
  vector<int> val, comp, z;
  int time = 0;
  int dfs(int i) {
    int low = val[i] = ++time, x;
    z.push_back(i);
    for (auto& e : gr[i])
      if (!comp[e]) low = min(low, val[e] ?: dfs(e));
    ++time;
    if (low == val[i]) do {
        x = z.back();
        z.pop_back();
        comp[x] = time;
        if (values[x >> 1] == -1) values[x >> 1] = !(x & 1);
      } while (x != i);
    return val[i] = low;
  }
  bool solve() {
    values.assign(N, -1);
    val.assign(2 * N, 0);
    comp = val;
    for (int i = 0; i < (2 * N); ++i)
      if (!comp[i]) dfs(i);
    for (int i = 0; i < (N); ++i)
      if (comp[2 * i] == comp[2 * i + 1]) return 0;
    return 1;
  }
};
int N, M, len[100005];
vector<int> a[100005];
int main() {
  cin.sync_with_stdio(false);
  cin.exceptions(cin.failbit);
  scanf("%d%d", &N, &M);
  for (int i = 0; i < N; i++) {
    scanf("%d", &len[i]);
    int x;
    for (int j = 0; j < len[i]; j++) {
      scanf("%d", &x);
      --x;
      a[i].push_back(x);
    }
  }
  TwoSat ts(M);
  for (int i = 0; i < N - 1; i++) {
    for (int j = 0; j < len[i]; j++) {
      if (len[i + 1] <= j) {
        cout << "No";
        return 0;
      }
      if (a[i][j] == a[i + 1][j]) continue;
      int a1 = a[i][j];
      int b1 = a[i + 1][j];
      if (a1 < b1) {
        ts.add_clause(a1, ~b1);
      } else {
        ts.set_value(a1);
        ts.set_value(~b1);
      }
      break;
    }
  }
  bool b = ts.solve();
  if (!b) {
    cout << "No" << endl;
  } else {
    vector<int> res;
    for (int i = 0; i < (M); ++i)
      if (ts.values[i]) res.push_back(i + 1);
    cout << "Yes" << endl;
    cout << (int)(res).size() << endl;
    for (auto& x : res) cout << x << ' ';
    cout << endl;
  }
  exit(0);
}
