#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const int maxm = 5e5 + 10;
struct st {
  int v, nex;
} edge[maxm];
int hed[maxn], vis[maxn], low[maxn], dfn[maxn], belon[maxn], Stack[maxn];
int in[maxn], out[maxn];
int n, m, e, top, cnt, num, sum1, sum2;
void init() {
  memset(hed, -1, sizeof(hed));
  memset(vis, 0, sizeof(vis));
  memset(dfn, 0, sizeof(dfn));
  memset(in, 0, sizeof(in));
  memset(out, 0, sizeof(out));
  e = 1;
  top = num = cnt = 0;
}
void add(int u, int v) { edge[e].v = v, edge[e].nex = hed[u], hed[u] = e++; }
void targan(int u) {
  dfn[u] = low[u] = ++num;
  Stack[top++] = u;
  vis[u] = 1;
  for (int i = hed[u]; ~i; i = edge[i].nex) {
    int v = edge[i].v;
    if (!dfn[v]) {
      targan(v);
      low[u] = (low[u] < low[v] ? low[u] : low[v]);
    } else if (vis[v]) {
      low[u] = (low[u] < dfn[v] ? low[u] : dfn[v]);
    }
  }
  if (low[u] == dfn[u]) {
    cnt++;
    int x;
    do {
      x = Stack[--top];
      vis[x] = 0;
      belon[x] = cnt;
    } while (x != u);
  }
}
vector<int> G[100005];
int ans[100005], anscnt;
int main() {
  anscnt = 0;
  init();
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    while (x--) {
      int nnum;
      scanf("%d", &nnum);
      G[i].push_back(nnum);
    }
  }
  for (int i = 1; i < n; i++) {
    int len = (G[i].size() < G[i + 1].size() ? G[i].size() : G[i + 1].size());
    int j;
    for (j = 0; j < len; j++) {
      if (G[i][j] == G[i + 1][j]) continue;
      break;
    }
    if (j == len && G[i].size() > G[i + 1].size()) {
      cout << "No" << endl;
      return 0;
    }
    if (j != len) {
      if (G[i][j] < G[i + 1][j]) {
        add(G[i][j], G[i + 1][j]);
        add(G[i + 1][j] + m, G[i][j] + m);
      } else {
        add(G[i][j], G[i][j] + m);
        add(G[i + 1][j] + m, G[i + 1][j]);
      }
    }
  }
  for (int i = 1; i <= 2 * m; i++)
    if (!dfn[i]) targan(i);
  for (int i = 1; i <= m; i++)
    if (belon[i] == belon[i + m]) {
      cout << "No" << endl;
      return 0;
    } else {
      if (belon[i] > belon[i + m]) ans[anscnt++] = i;
    }
  cout << "Yes" << endl;
  cout << anscnt << endl;
  for (int i = 0; i < anscnt; i++) printf("%d ", ans[i]);
  cout << endl;
  return 0;
}
