#include <bits/stdc++.h>
const int maxn = 5e5 + 3;
struct edge {
  int v;
  edge *n;
} ep[maxn], *el[maxn], epr[maxn], *elr[maxn], eps[maxn], *els[maxn];
int epl, eprl, epsl;
inline void addEdge(int u, int v) {
  el[u] = &(ep[epl++] = {v, el[u]});
  elr[v] = &(epr[eprl++] = {u, elr[v]});
}
inline void addSEdge(int u, int v) { els[u] = &(eps[epsl++] = {v, els[u]}); }
int ro[maxn], sid[maxn], rclk, ns;
char vis[maxn];
void dfs(int u) {
  vis[u] = 1;
  for (edge *e = el[u]; e; e = e->n) {
    if (!vis[e->v]) {
      dfs(e->v);
    }
  }
  ro[rclk++] = u;
}
void rdfs(int u) {
  vis[u] = 1;
  sid[u] = ns;
  for (edge *e = elr[u]; e; e = e->n) {
    if (!vis[e->v]) {
      rdfs(e->v);
    }
  }
}
void kosaraju(int n) {
  memset(vis, 0, n);
  rclk = 0;
  for (int u = 0; u < n; ++u) {
    if (!vis[u]) {
      dfs(u);
    }
  }
  memset(vis, 0, n);
  ns = 0;
  for (int u = n - 1; u >= 0; --u) {
    if (!vis[ro[u]]) {
      rdfs(ro[u]);
      ++ns;
    }
  }
  for (int u = 0; u < n; ++u) {
    for (edge *e = el[u]; e; e = e->n)
      if (sid[u] != sid[e->v]) {
        addSEdge(sid[u], sid[e->v]);
      }
  }
}
edge np[maxn], *nh[maxn], *nt[maxn];
int n, m, npl, len[maxn];
int color[maxn];
void cdfs(int u) {
  color[u] = 2;
  for (edge *e = el[u]; e; e = e->n)
    if (!color[e->v]) cdfs(e->v);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%d", len + i);
    for (int j = 0; j < len[i]; ++j, ++npl) {
      scanf("%d", &np[npl].v);
      --np[npl].v;
      np[npl].n = NULL;
      if (nt[i]) {
        nt[i] = nt[i]->n = np + npl;
      } else {
        nh[i] = nt[i] = np + npl;
      }
    }
  }
  for (int i = 0; i + 1 < n; ++i) {
    edge *p, *q;
    for (p = nh[i], q = nh[i + 1]; p && q; p = p->n, q = q->n) {
      if (p->v != q->v) {
        if (p->v < q->v) {
          addEdge(p->v << 1, q->v << 1);
          addEdge((q->v << 1) | 1, (p->v << 1) | 1);
        } else {
          addEdge(p->v << 1, (p->v << 1) | 1);
          addEdge((q->v << 1) | 1, q->v << 1);
        }
        break;
      }
    }
    if (p && !q) {
      puts("No");
      return 0;
    }
  }
  kosaraju(m * 2);
  for (int i = 0; i < m; ++i) {
    if (sid[i << 1] == sid[(i << 1) | 1]) {
      puts("No");
      return 0;
    }
  }
  for (int i = (m << 1) - 1; i >= 0; --i) {
    if (!color[ro[i]]) {
      color[ro[i]] = 1;
      cdfs(ro[i] ^ 1);
    }
  }
  std::vector<int> ans;
  for (int i = 0; i < m; ++i) {
    if (color[(i << 1) | 1] == 2) {
      ans.push_back(i + 1);
    }
  }
  puts("Yes");
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); ++i) {
    printf("%d%c", ans[i], " \n"[i == ans.size() - 1]);
  }
  return 0;
}
