#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  if (n > m + 1) {
    cout << "NO"
         << "\n";
    return 0;
  }
  int i, j, cnt = 0;
  for (i = 0; i < s.size(); i++) {
    if (s[i] != '*') cnt++;
    if (s[i] == '*')
      break;
    else if (s[i] != t[i]) {
      cout << "NO"
           << "\n";
      return 0;
    }
  }
  if (cnt == s.size() && cnt < t.size()) {
    cout << "NO"
         << "\n";
    return 0;
  }
  int d = t.size() - s.size();
  for (j = s.size() - 1; j > i; j--) {
    if (s[j] != t[j + d]) {
      cout << "NO"
           << "\n";
      return 0;
    }
  }
  cout << "YES"
       << "\n";
  return 0;
}
