#include <bits/stdc++.h>
using namespace std;
string s, t;
int sn, tn, dp[200010], idp[200010], p;
vector<int> v[26];
int main() {
  cin >> s >> t;
  for (int i = 0; i < t.size(); i++) {
    v[t[i] - 'a'].push_back(i);
  }
  for (int i = 0; i < s.size(); i++) {
    int c = s[i] - 'a';
    if (v[c].size() == 0) {
      cout << "NO" << endl;
      return 0;
    }
    if (t[p] - 'a' == c) {
      dp[i] = p;
      p++;
    } else {
      int l = -1, r = v[c].size();
      while (r - l > 1) {
        int mid = (l + r) / 2;
        if (v[c][mid] >= p)
          r = mid;
        else
          l = mid;
      }
      if (l == -1) {
        cout << "NO" << endl;
        return 0;
      }
      dp[i] = v[c][l];
    }
  }
  p = t.size() - 1;
  for (int i = s.size() - 1; i >= 0; i--) {
    int c = s[i] - 'a';
    if (t[p] - 'a' == c) {
      idp[i] = p;
      p--;
    } else {
      int l = -1, r = v[c].size();
      while (r - l > 1) {
        int mid = (l + r) / 2;
        if (v[c][mid] >= p)
          r = mid;
        else
          l = mid;
      }
      if (r == v[c].size()) {
        cout << "NO" << endl;
        return 0;
      }
      idp[i] = v[c][r];
    }
  }
  for (int i = 0; i < s.size(); i++) {
    if (dp[i] < idp[i]) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
