#include <bits/stdc++.h>
int l1, l2, a[100001], b[100001], nex[100001], fir[100001], tot, sto[100001],
    ru[100001], st[100001], head, tail, dp[100001], cnt, n, m;
bool p[100001], q;
void addbian(int aa, int bb) {
  tot++;
  nex[tot] = fir[aa];
  fir[aa] = tot;
  sto[tot] = bb;
}
int main() {
  scanf("%d%d", &n, &m);
  scanf("%d", &l1);
  for (int i = 1; i <= m; i++) p[i] = false;
  tot = 0;
  q = true;
  for (int i = 1; i <= l1; i++) scanf("%d", &a[i]);
  for (int j = 1; j <= n - 1; j++) {
    scanf("%d", &l2);
    for (int i = 1; i <= l2; i++) scanf("%d", &b[i]);
    if (q == false) continue;
    int p1 = -1;
    for (int i = 1; i <= l2; i++) {
      if (i > l1) break;
      if (b[i] != a[i]) {
        p1 = 0;
        addbian(b[i], a[i]);
        p[b[i]] = true;
        p[a[i]] = true;
        ru[a[i]]++;
        break;
      }
    }
    if (p1 == -1) {
      if (l1 > l2) {
        q = false;
        continue;
      }
    }
    for (int i = 1; i <= l1; i++) a[i] = 0;
    for (int i = 1; i <= l2; i++) a[i] = b[i];
    l1 = l2;
  }
  tail = 0;
  head = 1;
  cnt = 0;
  for (int i = 1; i <= m; i++) dp[i] = -1;
  if (q == false)
    printf("No\n");
  else {
    if (tot == 0)
      printf("Yes\n0");
    else {
      for (int i = 1; i <= m; i++)
        if (p[i]) {
          if (ru[i] == 0) {
            tail++;
            st[tail] = i;
            p[i] = false;
          }
        }
      if (tail == 0)
        printf("No\n");
      else {
        q = false;
        while (head <= tail) {
          int aa = fir[st[head]];
          while (aa != 0) {
            ru[sto[aa]]--;
            if (sto[aa] > st[head]) {
              if (dp[st[head]] == 1) {
                q = true;
                break;
              }
              dp[sto[aa]] = 1;
            } else
              dp[sto[aa]] = dp[st[head]];
            if (ru[sto[aa]] == 0) {
              tail++;
              st[tail] = sto[aa];
              p[sto[aa]] = false;
            }
            aa = nex[aa];
          }
          if (q) break;
          head++;
        }
        for (int i = 1; i <= m; i++)
          if (p[i]) {
            q = true;
            break;
          }
        if (q)
          printf("No\n");
        else {
          printf("Yes\n");
          for (int i = 1; i <= m; i++)
            if (dp[i] == 1) {
              cnt++;
              a[cnt] = i;
            }
          printf("%d\n", cnt);
          for (int i = 1; i <= cnt; i++) printf("%d ", a[i]);
        }
      }
    }
  }
}
