#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;
const int mod = (int)1e9 + 7;
const int MAX = (int)1e5 + 5;
vector<int> store[MAX];
vector<int> edge[MAX];
vector<int> ans;
bitset<MAX> check;
bitset<MAX> kind;
bool conflict = 0;
void dfs(int v) {
  for (int u : edge[v]) {
    if (conflict) return;
    if (check[u] && kind[u]) {
      conflict = 1;
      return;
    }
    check[u] = 1;
    kind[u] = 0;
    dfs(u);
  }
  return;
}
int main(void) {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < (n); ++i) {
    int k;
    scanf("%d", &k);
    for (int j = 0; j < (k); ++j) {
      int v;
      scanf("%d", &v);
      store[i].push_back(v);
    }
  }
  for (int i = 0; i < (n - 1); ++i) {
    int l = min((int)store[i].size(), (int)store[i + 1].size());
    bool flag = 0;
    for (int j = 0; j < (l); ++j) {
      int v1 = store[i][j], v2 = store[i + 1][j];
      if (v1 > v2) {
        if ((check[v1] && kind[v1]) || (check[v2] && !kind[v2])) {
          puts("No");
          return 0;
        }
        check[v1] = 1;
        check[v2] = 1;
        kind[v1] = 0;
        kind[v2] = 1;
        dfs(v1);
        if (conflict) {
          puts("No");
          return 0;
        }
        flag = 1;
        break;
      } else if (v1 < v2) {
        if (check[v1] && check[v2] && kind[v1] && !kind[v2]) {
          puts("No");
          return 0;
        } else if (check[v2] && !kind[v2]) {
          if (!check[v1]) {
            check[v1] = 1;
            kind[v1] = 0;
          }
        } else if (check[v1] && kind[v1]) {
          check[v2] = 1;
          kind[v2] = 1;
        }
        edge[v2].push_back(v1);
        flag = 1;
        break;
      }
    }
    if (!flag && store[i].size() > store[i + 1].size()) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  int cnt = 0;
  for (int i = (1); i < (m + 1); ++i)
    if (check[i] && !kind[i]) ans.push_back(i);
  printf("%d\n", (int)ans.size());
  for (int x : ans) printf("%d ", x);
  return 0;
}
