#include <bits/stdc++.h>
using namespace std;
int n, m, cnt, tot;
int len, lst[200005], a[200005], col[200005];
int head[200005], Next[200005 * 2], vet[200005 * 2];
void add(int x, int y) {
  cnt++;
  Next[cnt] = head[x];
  head[x] = cnt;
  vet[cnt] = y;
}
int low[200005], dfn[200005], vis[200005], T;
stack<int> s;
void tarjan(int x) {
  low[x] = dfn[x] = ++T;
  vis[x] = true;
  s.push(x);
  for (int i = head[x]; i; i = Next[i]) {
    int v = vet[i];
    if (!dfn[v]) {
      tarjan(v);
      low[x] = min(low[x], low[v]);
    } else if (vis[v]) {
      low[x] = min(low[x], dfn[v]);
    }
  }
  if (low[x] == dfn[x]) {
    tot++;
    int t = -1;
    while (t != x) {
      t = s.top();
      s.pop();
      vis[t] = false;
      col[t] = tot;
    }
  }
}
int main() {
  cin >> m >> n;
  for (int i = 1; i <= m; i++) {
    int t;
    scanf("%d", &t);
    for (int j = 1; j <= t; j++) {
      scanf("%d", &a[j]);
    }
    for (int j = 1; j <= min(len, t); j++) {
      if (lst[j] < a[j]) {
        add(a[j] + n, lst[j] + n);
        add(lst[j], a[j]);
        break;
      } else if (lst[j] > a[j]) {
        add(lst[j], lst[j] + n);
        add(a[j] + n, a[j]);
        break;
      }
      if (j == min(len, t) && len > t) {
        puts("No");
        return 0;
      }
    }
    len = t;
    for (int j = 1; j <= t; j++) lst[j] = a[j];
  }
  for (int i = 1; i <= n * 2; i++) {
    if (!dfn[i]) tarjan(i);
  }
  for (int i = 1; i <= n; i++) {
    if (col[i] == col[i + n]) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (col[i] > col[i + n]) {
      ans++;
    }
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) {
    if (col[i] > col[i + n]) {
      printf("%d ", i);
    }
  }
  return 0;
}
