#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> t >> s;
  if (t.size() < s.size()) {
    cout << "NO" << endl;
    return 0;
  }
  vector<int> pr(t.size());
  vector<int> suf(t.size());
  pr[0] = (t[0] == s[0]) ? 1 : 0;
  for (int i = 1; i < t.size(); ++i) {
    pr[i] = pr[i - 1] + ((t[i] == s[pr[i - 1]]) ? 1 : 0);
  }
  suf[t.size() - 1] = (t[t.size() - 1] == s[s.size() - 1]) ? 1 : 0;
  for (int i = t.size() - 2; i >= 0; --i) {
    if (suf[i + 1] == s.size())
      suf[i] = s.size();
    else
      suf[i] = suf[i + 1] + ((t[i] == s[s.size() - 1 - suf[i + 1]]) ? 1 : 0);
  }
  vector<vector<int> > pos(26);
  for (int i = 0; i < s.size(); ++i) pos[s[i] - 'a'].push_back(i);
  for (int i = 0; i < t.size(); ++i) {
    if (pr[i] + suf[i] < s.size()) {
      cout << "NO" << endl;
      return 0;
    }
    int minp = min(pr[i], (int)s.size() - 1 - suf[i]);
    int maxp = max(pr[i], (int)s.size() - 1 - suf[i]);
    int z = lower_bound(pos[t[i] - 'a'].begin(), pos[t[i] - 'a'].end(), minp) -
            pos[t[i] - 'a'].begin();
    if (z == pos[t[i] - 'a'].size()) {
      cout << "NO" << endl;
      return 0;
    }
    if (pos[t[i] - 'a'][z] > maxp) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
