#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m, flag = 0;
  cin >> n >> m;
  char s[n], t[m];
  for (long long int i = 0; i < n; i++) {
    cin >> s[i];
    if (s[i] == '*') flag = 1;
  }
  for (long long int i = 0; i < m; i++) cin >> t[i];
  if (flag == 1) {
    if (n - 1 > m) {
      cout << "NO" << endl;
      return 0;
    }
    for (long long int i = 0; s[i] != '*'; i++) {
      if (s[i] == t[i])
        continue;
      else {
        cout << "NO" << endl;
        return 0;
      }
    }
    long long int j = m - 1;
    for (long long int i = n - 1; s[i] != '*'; i--) {
      if (s[i] == t[j]) {
        j--;
        continue;
      } else {
        cout << "NO" << endl;
        return 0;
      }
    }
    cout << "YES" << endl;
  } else {
    if (m == n) {
      for (long long int i = 0; i < n; i++) {
        if (s[i] == t[i])
          continue;
        else {
          cout << "NO" << endl;
          return 0;
        }
      }
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
      return 0;
    }
  }
  return 0;
}
