#include <bits/stdc++.h>
using namespace std;
vector<int> s[101010];
int vis[101010], cant[101010], pp, f[101010], a[101010], b[101010];
void dfs(int x) {
  int c, i, y;
  vis[x] = 1;
  if (cant[x] == 1) pp = -1;
  c = s[x].size();
  for (i = 0; i < c; i++) {
    y = s[x][i];
    if (vis[y] == 1) continue;
    dfs(y);
  }
}
int main() {
  int n, m, i, lena = 0, lenb, p, cnt = 0, j;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%d", &lenb);
    for (j = 1; j <= lenb; j++) {
      scanf("%d", &b[j]);
    }
    p = 0;
    for (j = 1; j <= min(lena, lenb); j++) {
      if (a[j] == b[j]) continue;
      p = 1;
      if (a[j] > b[j]) {
        if (vis[b[j]] == 1) {
          printf("No");
          return 0;
        }
        if (vis[a[j]] == 0) {
          dfs(a[j]);
          cant[b[j]] = 1;
        }
        if (pp == -1) break;
      } else {
        if (vis[b[j]] == 1) {
          if (vis[a[j]] == 0) dfs(a[j]);
        } else {
          if (vis[a[j]] == 0) s[b[j]].push_back(a[j]);
        }
        if (pp == -1) break;
      }
      break;
    }
    if (p == 0) {
      if (lena > lenb) {
        printf("No");
        return 0;
      }
    }
    lena = lenb;
    for (j = 1; j <= lenb; j++) {
      a[j] = b[j];
    }
    if (pp == -1) break;
  }
  if (pp == -1) {
    printf("No");
    return 0;
  }
  for (i = 1; i <= m; i++) {
    if (vis[i] == 1) {
      f[++cnt] = i;
    }
  }
  printf("Yes\n");
  printf("%d\n", cnt);
  for (i = 1; i <= cnt; i++) {
    printf("%d ", f[i]);
  }
  return 0;
}
