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