#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int lens, lent, cnt[30];
int l[N], r[N];
char s[N], t[N];
int main(void) {
  scanf("%s%s", s + 1, t + 1);
  lens = strlen(s + 1), lent = strlen(t + 1);
  memset(cnt, 0, sizeof cnt);
  int p = 1;
  for (int i = 1; i <= lens; ++i) {
    if (p <= lent && s[i] == t[p]) {
      cnt[s[i] - 'a'] = p;
      ++p;
    }
    l[i] = cnt[s[i] - 'a'];
  }
  memset(cnt, 0, sizeof cnt);
  p = lent;
  for (int i = lens; i; --i) {
    if (p && s[i] == t[p]) {
      cnt[s[i] - 'a'] = p;
      --p;
    }
    r[i] = lent - cnt[s[i] - 'a'] + 1;
  }
  for (int i = 1; i <= lens; ++i)
    if (!l[i] || r[i] > lent || l[i] + r[i] - 1 < lent) {
      puts("NO");
      return 0;
    }
  puts("YES");
  return 0;
}
