#include <bits/stdc++.h>
using namespace std;
queue<int> qewe;
int n, m, num = 0, nm = 0, cnt = 0, dfssfeee[100010], head[100010], nxt[200010],
          vtot[200010];
int dp[2][100010], r[100010], dfssd[100010];
void add(int u, int v) {
  nxt[++cnt] = head[u];
  vtot[cnt] = v;
  head[u] = cnt;
}
template <class T>
inline void read(T &res) {
  static char ch;
  T flag = 1;
  while ((ch = getchar()) < '0' || ch > '9')
    if (ch == '-') flag = -1;
  res = ch - 48;
  while ((ch = getchar()) >= '0' && ch <= '9') res = res * 10 + ch - 48;
  res *= flag;
}
namespace IO {
int prime[1100000], primesize, phi[11000000];
bool isprime[11000000];
void getlist(int listsize) {
  memset(isprime, 1, sizeof(isprime));
  isprime[1] = false;
  for (int i = 2; i <= listsize; i++) {
    if (isprime[i]) prime[++primesize] = i;
    for (int j = 1; j <= primesize && i * prime[j] <= listsize; j++) {
      isprime[i * prime[j]] = false;
      if (i % prime[j] == 0) break;
    }
  }
}
}  // namespace IO
int main() {
  read(n), read(m);
  for (register int i = 1; i <= n; i++) {
    register int rt = i & 1, pre = (i - 1) & 1;
    if (i == 1) {
      read(dp[rt][0]);
      for (register int j = 1; j <= dp[rt][0]; j++) read(dp[rt][j]);
    } else {
      read(dp[rt][0]);
      for (register int j = 1; j <= dp[rt][0]; j++) read(dp[rt][j]);
      bool flag = 1;
      for (register int j = 1, k = 1; j <= dp[pre][0] && k <= dp[rt][0];
           j++, k++)
        if (dp[pre][j] != dp[rt][k]) {
          flag = 0;
          add(dp[pre][j], dp[rt][k]), r[dp[rt][k]]++;
          break;
        }
      if (flag && dp[pre][0] > dp[rt][0]) return puts("No"), 0;
    }
  }
  memset(dfssd, -1, sizeof(dfssd));
  for (register int i = 1; i <= m; i++)
    if (r[i] == 0) qewe.push(i), num++, dfssd[i] = 0;
  using namespace IO;
  while (!qewe.empty()) {
    register int u = qewe.front();
    qewe.pop();
    for (register int i = head[u]; i; i = nxt[i]) {
      if (r[vtot[i]] > 0) {
        r[vtot[i]]--;
        dfssd[vtot[i]] = max(dfssd[vtot[i]], dfssd[u] + (u > vtot[i]));
        if (r[vtot[i]] == 0) qewe.push(vtot[i]), num++;
      }
    }
  }
  for (register int i = 1; i <= m; i++) {
    if (dfssd[i] > 1 || dfssd[i] == -1) return puts("No"), 0;
    if (dfssd[i] == 0) dfssfeee[++nm] = i;
  }
  puts("Yes");
  cout << nm << endl;
  for (register int i = 1; i <= nm; i++) cout << dfssfeee[i] << ' ';
  return 0;
}
