#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const long long ooo = 9223372036854775807ll;
const int _cnt = 1000 * 1000 + 7;
const int _p = 1000 * 1000 * 1000 + 7;
const int N = 300005;
const double PI = acos(-1.0);
const double eps = 1e-9;
int o(int x) { return x % _p; }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
void file_put() {
  freopen("filename.in", "r", stdin);
  freopen("filename.out", "w", stdout);
}
struct ttype {
  int x, y;
};
const int _N = 1e6 + 5, _M = 1e6 + 5;
struct Tu {
  int head[_N], nxt[_M], e[_M], n, tot;
  void Init(int _n) { n = _n, memset(head, 0, sizeof(head)), tot = 0; }
  void I(int x, int y) {
    e[++tot] = y;
    nxt[tot] = head[x], head[x] = tot;
  }
};
int n, m;
int s[2][100005], k = 0, tot = 0, c[N];
ttype t[N];
bool vis[N];
Tu T;
bool dfs(int x) {
  vis[x] = 1;
  if (c[x] == 0) return false;
  c[x] = 1;
  bool tt = 1;
  for (int i = T.head[x]; i; i = T.nxt[i]) {
    if (vis[T.e[i]]) continue;
    tt &= dfs(T.e[i]);
  }
  return tt;
}
int main() {
  scanf("%d%d", &m, &n);
  for (int i = (1); i <= (m); ++i) {
    scanf("%d", &k);
    s[i & 1][0] = k + 1;
    for (int j = (1); j <= (k); ++j) scanf("%d", &s[i & 1][j]);
    s[i & 1][k + 1] = -1;
    if (i == 1) continue;
    int j = 1;
    while (s[i & 1][j] == s[i & 1 ^ 1][j] && s[i & 1][j] != -1 &&
           s[i & 1 ^ 1][j] != -1)
      j++;
    if (s[i & 1][j] == -1 && s[i & 1 ^ 1][j] == -1) continue;
    if (s[i & 1 ^ 1][j] == -1) continue;
    if (s[i & 1][j] == -1) return 0 * printf("No\n");
    t[++tot] = ttype{s[i & 1 ^ 1][j], s[i & 1][j]};
  }
  memset(c, -1, sizeof(c));
  T.Init(n);
  for (int i = (1); i <= (tot); ++i) {
    if (t[i].x < t[i].y) continue;
    if (c[t[i].x] == 1 || c[t[i].y] == 0) return 0 * printf("No");
    c[t[i].x] = 0, c[t[i].y] = 1;
  }
  for (int i = (1); i <= (tot); ++i) {
    if (t[i].x > t[i].y) continue;
    T.I(t[i].x, t[i].y);
  }
  memset(vis, 0, sizeof(vis));
  for (int i = (1); i <= (n); ++i) {
    if (vis[i] || c[i] != 1) continue;
    if (!dfs(i)) return 0 * printf("No");
  }
  for (int i = (1); i <= (n); ++i)
    if (c[i] == -1) c[i] = 0;
  int ans = 0;
  for (int i = (1); i <= (n); ++i) ans += (c[i] == 0);
  printf("Yes\n");
  printf("%d\n", ans);
  for (int i = (1); i <= (n); ++i)
    if (c[i] == 0) printf("%d ", i);
  return 0;
}
