#include <bits/stdc++.h>
using namespace std;
int const maxn = 2e5 + 100;
stack<int> st;
struct bkn {
  int to, next;
} e[maxn * 4], e2[maxn * 4];
vector<int> num[maxn];
int head[maxn], dfn[maxn], low[maxn], scc, cnt, tot, col[maxn], dl[maxn],
    cl[maxn];
int head2[maxn], n, m, ans[maxn], vis[maxn], q[maxn];
void add(int a, int b) {
  e[tot].to = b, e[tot].next = head[a], head[a] = tot++;
}
void add2(int a, int b) {
  e2[tot].to = b, e2[tot].next = head2[a], head2[a] = tot++;
}
void tarjan(int x) {
  dfn[x] = low[x] = ++cnt;
  vis[x] = 1;
  st.push(x);
  for (int i = head[x]; i; i = e[i].next) {
    int y = e[i].to;
    if (!dfn[y])
      tarjan(y), low[x] = min(low[x], low[y]);
    else if (vis[y])
      low[x] = min(low[x], low[y]);
  }
  if (dfn[x] == low[x]) {
    int y;
    scc++;
    do {
      y = st.top();
      vis[y] = 0;
      col[y] = scc;
      st.pop();
    } while (x != y);
  }
}
void dfs(int x) {
  vis[x] = 1;
  for (int i = head2[x]; i; i = e2[i].next) {
    int y = e2[i].to;
    if (!vis[y]) dfs(y);
  }
  q[++cnt] = x;
}
int main() {
  tot = 1;
  scanf("%d%d", &n, &m);
  int ok = 1;
  int l;
  scanf("%d", &l);
  for (int i = 1; i <= l; i++) {
    int x;
    scanf("%d", &x);
    num[1].push_back(x);
  }
  for (int i = 2; i <= n; i++) {
    scanf("%d", &l);
    for (int j = 1; j <= l; j++) {
      int x;
      scanf("%d", &x);
      num[i].push_back(x);
    }
    int sz = num[i - 1].size();
    int p = 0;
    for (int j = 0; j < sz; j++) {
      if (num[i - 1][j] == num[i][p]) {
        p++;
        if (p == l && l < sz) {
          ok = 0;
          break;
        }
        continue;
      }
      int x = num[i - 1][j], y = num[i][p];
      if (x < y)
        add(y + m, x + m), add(x, y);
      else
        add(x, x + m), add(y + m, y);
      break;
    }
  }
  if (!ok) {
    printf("No\n");
    return 0;
  }
  for (int i = 1; i <= 2 * m; i++)
    if (!dfn[i]) tarjan(i);
  cnt = 0;
  for (int i = 1; i <= m; i++) {
    if (col[i] == col[i + m]) {
      printf("No\n");
      return 0;
    }
    dl[col[i]] = col[i + m];
    dl[col[i + m]] = col[i];
  }
  printf("Yes\n");
  tot = 1;
  for (int x = 1; x <= 2 * m; x++) {
    for (int i = head[x]; i; i = e[i].next) {
      int y = e[i].to;
      if (col[x] != col[y]) add2(col[y], col[x]);
    }
  }
  for (int i = 1; i <= scc; i++)
    if (!vis[i]) dfs(i);
  for (int i = cnt; i >= 1; i--) {
    int x = q[i], d = dl[x];
    if (!cl[x]) cl[x] = 1, cl[d] = 2;
  }
  int sum = 0;
  for (int i = 1; i <= m; i++) {
    int t = col[i];
    if (cl[t] == 2) ans[++sum] = i;
  }
  printf("%d\n", sum);
  for (int i = 1; i <= sum; i++) {
    printf("%d ", ans[i]);
  }
  printf("\n");
}
