#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int MAXN = 2 * 100000 + 1;
char s[MAXN], t[MAXN];
int n, m, step[26];
struct alph {
  int k[26];
  alph operator+=(const alph& a) {
    for (int i = 0; i < 26; i++) k[i] += a.k[i];
    return *this;
  }
  alph operator+=(const char c) {
    k[int(c - 'a')]++;
    return *this;
  }
  alph operator-(const alph& a) const {
    alph ans;
    for (int i = 0; i < 26; i++) ans.k[i] = k[i] - a.k[i];
    return ans;
  }
  friend bool operator>=(const alph& a, const alph& b) {
    bool ans = true;
    for (int i = 0; i < 26; i++) ans = ans && (a.k[i] >= b.k[i]);
    return ans;
  }
} sum_s[MAXN], sum_t[MAXN];
bool can(int a, int b) {
  if (b == -1) return false;
  return (sum_s[n - 1] - sum_s[a] >= sum_t[m - 1] - sum_t[b]);
}
void Load() {
  scanf("%s\n%s", s, t);
  n = strlen(s);
  m = strlen(t);
  sum_s[0] += s[0];
  sum_t[0] += t[0];
  for (int i = 1; i < n; i++) {
    sum_s[i] += sum_s[i - 1];
    sum_s[i] += s[i];
  }
  for (int i = 1; i < m; i++) {
    sum_t[i] += sum_t[i - 1];
    sum_t[i] += t[i];
  }
  for (int i = 0; i < 26; i++) step[i] = -1;
}
int main() {
  Load();
  bool NA = true;
  int j = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == t[j] && j < m) {
      step[int(s[i] - 'a')] = j;
      j++;
    }
    NA = NA && can(i, step[int(s[i] - 'a')]);
    if (!NA) break;
  }
  printf("%s\n", NA ? "YES" : "NO");
  return 0;
}
