#include <bits/stdc++.h>
using namespace std;
int n, m, mx, g, cnt, sz[200005], num[200005], l[200005], r[200005];
bool zz, v[200005], h[200005];
vector<int> a[200005];
int main() {
  int i, j, t, t1, t2;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    scanf("%d", &sz[i]);
    mx = max(mx, sz[i]);
    for (j = 0; j < sz[i]; j++) {
      scanf("%d", &t);
      a[i].push_back(t + m);
    }
  }
  for (i = 1; i <= m; i++) num[i] = i;
  for (i = 1; i <= m; i++) num[m + i] = m + i;
  while (1) {
    zz = false;
    for (i = n - 1; i >= 1; i--) h[i] = true;
    r[0] = 1;
    l[n + 1] = n;
    for (i = n; i >= 1; i--) {
      l[i] = i - 1;
      r[i] = i + 1;
    }
    for (i = 0; i < mx; i++) {
      if (sz[n] > i)
        g = num[a[n][i]];
      else
        g = 2e9;
      for (j = l[n + 1]; j >= 1; j = l[j]) {
        if (sz[j] == i) {
          h[j - 1] = false;
          t1 = l[j];
          t2 = r[j];
          l[t2] = t1;
          r[t1] = t2;
          continue;
        }
        if (num[a[j][i]] > g && h[j]) {
          if (num[a[j][i]] <= m) {
            cout << "No";
            return 0;
          }
          zz = true;
          num[a[j][i]] -= m;
          v[num[a[j][i]]] = 1;
          h[j] = false;
        } else if (h[j]) {
          if (num[a[j][i]] < g) h[j] = false;
        }
        g = num[a[j][i]];
      }
    }
    if (!zz) break;
  }
  for (i = 2; i <= n; i++) {
    int en = min(sz[i - 1], sz[i]);
    for (j = 0; j < en; j++) {
      if (num[a[i - 1][j]] > num[a[i][j]]) {
        cout << "No";
        return 0;
      } else if (num[a[i - 1][j]] < num[a[i][j]])
        break;
    }
    if (j == en && sz[i - 1] > sz[i]) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes" << endl;
  for (i = 1; i <= m; i++) {
    if (v[i]) cnt++;
  }
  cout << cnt << endl;
  for (i = 1; i <= m; i++) {
    if (v[i]) printf("%d ", i);
  }
  return 0;
}
