#include <bits/stdc++.h>
using namespace std;
ifstream fin("in.in");
ofstream fout("out.out");
const int N = 2e5 + 10;
int n, m, maxL[N], maxR[N];
vector<int> st[26 + 10];
string s, t;
bool check(int x, int l, int r) {
  if (st[x].empty() || r + l < m - 1) return false;
  int lb = lower_bound(st[x].begin(), st[x].end(), m - r - 1) - st[x].begin();
  if (lb == st[x].size()) return false;
  if (st[x][lb] > l) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s >> t;
  n = s.length();
  m = t.length();
  if (n < m) return (cout << "NO"), 0;
  for (int i = 0; i < m; i++) st[t[i] - 'a'].push_back(i);
  maxL[0] = (s[0] == t[0]);
  for (int i = 1; i < n; i++) {
    if (maxL[i - 1] == m)
      maxL[i] = m;
    else if (t[maxL[i - 1]] == s[i])
      maxL[i] = maxL[i - 1] + 1;
    else
      maxL[i] = maxL[i - 1];
  }
  maxR[n - 1] = (s[n - 1] == t[m - 1]);
  for (int i = n - 2; i >= 0; i--) {
    if (maxR[i + 1] == m)
      maxR[i] = m;
    else if (t[m - maxR[i + 1] - 1] == s[i])
      maxR[i] = maxR[i + 1] + 1;
    else
      maxR[i] = maxR[i + 1];
  }
  for (int i = 0; i < n; i++)
    if (!check(s[i] - 'a', maxL[i], maxR[i])) return (cout << "NO"), 0;
  cout << "YES" << endl;
  return 0;
}
