#include <bits/stdc++.h>
using namespace std;
int x = 0;
int y = 0, a, b, c;
vector<int> v1, v2, v;
vector<bool> zaplo;
vector<vector<int> > vv1, vv2;
pair<int, int> foo;
int n, m, k;
string second, s1;
int sum = 0;
vector<vector<int> > input;
int min(int a, int b) {
  if (a > b) {
    return b;
  } else {
    return a;
  }
}
int gcd(int c, int d) {
  if (c < d) switch (c, d)
      ;
  if (d == 0) return c;
  return gcd(d, c % d);
}
pair<int, int> str(int a, int b) {
  pair<int, int> parek;
  for (int i = 0; i < min(input[a].size(), input[b].size()); i++) {
    if (input[a][i] != input[b][i]) {
      parek = make_pair(input[a][i], input[b][i]);
      return parek;
    } else if (i + 1 == min(input[a].size(), input[b].size())) {
      if (input[a].size() > input[b].size()) {
        parek = make_pair(-1, -1);
        return parek;
      }
    }
  }
  parek = make_pair(-2, -2);
  return parek;
}
void dfs(int second) {
  zaplo[second] = 1;
  for (auto u : vv1[second]) {
    dfs(u);
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n >> m;
  input.resize(n);
  zaplo.resize(m);
  vv1.resize(m);
  vv2.resize(m);
  for (int i = 0; i < n; i++) {
    cin >> x;
    for (int j = 0; j < x; j++) {
      cin >> y;
      y--;
      input[i].push_back(y);
    }
  }
  for (int i = 0; i < m; i++) {
    zaplo[i] = 0;
  }
  for (int i = 0; i < n - 1; i++) {
    foo = str(i, i + 1);
    if (foo.first == -1) {
      cout << "No" << endl;
      return 0;
    } else if (foo.first >= 0) {
      if (foo.first > foo.second) {
        vv2[foo.first].push_back(foo.second);
        vv2[foo.second].push_back(foo.first);
        zaplo[foo.first] = 1;
      } else if (foo.first < foo.second) {
        vv1[foo.second].push_back(foo.first);
      }
    }
  }
  for (int i = 0; i < m; i++) {
    if (zaplo[i]) {
      dfs(i);
    }
  }
  for (int i = 0; i < m; i++) {
    if (zaplo[i]) {
      sum++;
      for (int j = 0; j < vv2[i].size(); j++) {
        if (zaplo[vv2[i][j]]) {
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  cout << "Yes" << endl;
  cout << sum << endl;
  if (sum >= 1) {
    for (int i = 0; i < m; i++) {
      if (zaplo[i]) {
        cout << i + 1 << " ";
      }
    }
    cout << endl;
  }
  return 0;
}
