#include <bits/stdc++.h>
int dr[] = {2, 2, -2, -2, 1, -1, 1, -1};
int dc[] = {1, -1, 1, -1, 2, 2, -2, -2};
int dr1[] = {0, 0, 0, 1, 1, 1, -1, -1, -1};
int dc1[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
int dr2[] = {0, 0, 1, -1};
int dc2[] = {1, -1, 0, 0};
using namespace std;
long long int pr[200005], su[200005];
vector<long long int> adj[200005], adj1[200005];
int main() {
  string t, s;
  long long int i, j;
  while (cin >> s >> t) {
    long long int pos = 0;
    for (i = 0; i < s.size(); i++) {
      long long int p = s[i] - 'a';
      adj[p].push_back(i);
    }
    for (i = 0; i < t.size(); i++) {
      long long int p = t[i] - 'a';
      adj1[p].push_back(i);
      if (adj[p].size() == 0) {
        cout << "NO" << endl;
        return 0;
      }
      long long int lo = 0, hi = adj[p].size() - 1, mid, ans = -1;
      while (lo <= hi) {
        mid = (lo + hi) >> 1;
        long long int r = adj[p][mid];
        if (r >= pos) {
          ans = r;
          hi = mid - 1;
        } else
          lo = mid + 1;
      }
      if (ans == -1) {
        cout << "NO" << endl;
        return 0;
      }
      pr[ans] = 1;
      pos = ans + 1;
    }
    pos = s.size() - 1;
    for (i = t.size() - 1; i >= 0; i--) {
      long long int p = t[i] - 'a';
      long long int lo = 0, hi = adj[p].size() - 1, mid, ans = -1;
      while (lo <= hi) {
        mid = (lo + hi) >> 1;
        long long int r = adj[p][mid];
        if (r <= pos) {
          ans = r;
          lo = mid + 1;
        } else
          hi = mid - 1;
      }
      su[ans] = 1;
      pos = ans - 1;
    }
    for (i = 0; i < s.size(); i++) {
      pr[i] += pr[i - 1];
    }
    for (i = s.size() - 1; i >= 0; i--) {
      su[i] += su[i + 1];
    }
    bool f = 0;
    for (i = 0; i < s.size(); i++) {
      long long int r = pr[i];
      long long int p = s[i] - 'a';
      if (adj1[p].size() == 0) {
        cout << "NO" << endl;
        return 0;
      }
      long long int lo = 0, hi = adj1[p].size() - 1, ans = -1;
      while (lo <= hi) {
        long long int mid = (lo + hi) >> 1;
        long long int p1 = adj1[p][mid];
        if (p1 < r) {
          lo = mid + 1;
          ans = p1;
        } else
          hi = mid - 1;
      }
      if (ans == -1) {
        cout << "NO" << endl;
        return 0;
      }
      long long int baki = t.size() - ans - 1;
      if (su[i + 1] < baki) {
        cout << "NO" << endl;
        return 0;
      }
    }
    cout << "YES" << endl;
  }
  return 0;
}
