#include <bits/stdc++.h>
using namespace std;
const int M = 200000 + 10;
int L[M];
int R[M];
vector<int> alpha[50];
vector<int> beta1[50];
vector<int> beta2[50];
int main() {
  for (int i = 0; i < M; i++) {
    L[i] = R[i] = -1;
  }
  string s, t;
  cin >> s >> t;
  int idx = 0;
  for (int i = 0; i < t.length(); i++) {
    while (idx < s.length() && s[idx] != t[i]) {
      idx++;
    }
    if (idx < s.length()) {
      L[i] = idx;
      idx++;
    }
  }
  idx = s.length() - 1;
  for (int i = t.length() - 1; i >= 0; i--) {
    while (idx >= 0 && s[idx] != t[i]) {
      idx--;
    }
    if (idx >= 0) {
      R[i] = idx;
      idx--;
    }
  }
  for (int i = 0; i < s.length(); i++) {
    int num = s[i] - 'a';
    alpha[num].push_back(i);
  }
  bool ok = true;
  for (int i = 0; i < t.length(); i++) {
    if (L[i] == -1 || R[i] == -1) {
      ok = false;
    }
  }
  if (ok) {
    for (int i = 0; i < t.length(); i++) {
      int num = t[i] - 'a';
      beta1[num].push_back(L[i]);
      beta2[num].push_back(R[i]);
    }
    int total = 0;
    for (int i = 0; i < 26; i++) {
      int idx = 0;
      for (int j = 0; j < beta1[i].size(); j++) {
        int l = beta1[i][j];
        int r = beta2[i][j];
        while (idx < alpha[i].size()) {
          if (alpha[i][idx] >= l && alpha[i][idx] <= r) {
            idx++;
            total++;
          } else {
            break;
          }
        }
      }
    }
    if (total == s.length()) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
