#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int MAXN = (int)2e5 + 5;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const int MAXS = 32 * 1024 * 1024;
char buf[MAXS], *ch;
void read(int &x) {
  while (*ch <= 32) ++ch;
  for (x = 0; *ch >= '0'; ++ch) x = x * 10 + *ch - '0';
}
void std_init() {
  ch = buf - 1;
  fread(buf, 1, MAXS, stdin);
}
int main() {
  int n, m, p = -1;
  string s1, s2;
  cin >> n >> m >> s1 >> s2;
  for (int i = 0; i < n; i++)
    if (s1[i] == '*') p = i;
  if ((n > m + 1) || (n > m && p == -1)) {
    cout << "NO" << endl;
    ;
    return 0;
  }
  if (p == -1) {
    for (int i = 0; i < max(n, m); ++i) {
      if (s1[i] != s2[i]) {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (s1[i] != s2[i] && s1[i] != '*') {
      cout << "NO" << endl;
      return 0;
    }
    if (s1[i] == '*') break;
  }
  --m;
  for (int i = n - 1; i > p; --i) {
    if (s1[i] != s2[m]) {
      cout << "NO" << endl;
      return 0;
    }
    m--;
  }
  cout << "YES\n";
  return 0;
}
