#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
void qread(int &x) {
  int neg = 1;
  x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = 10 * x + c - '0', c = getchar();
  x *= neg;
}
const int maxn = 200005;
char c[maxn];
int n, m;
string s, t;
int main() {
  scanf("%d%d", &n, &m);
  scanf("%s", c);
  s = c;
  scanf("%s", c);
  t = c;
  bool ok = false;
  for (int(i) = 0; (i) < n; i++)
    if (s[i] == '*') ok = true;
  if (!ok) {
    puts(s == t ? "YES" : "NO");
    return 0;
  }
  int pre = 0, suf = 0;
  while (s[pre] != '*' && s[pre] == t[pre]) pre++;
  while (s[n - suf - 1] != '*' && s[n - suf - 1] == t[m - suf - 1]) suf++;
  if (s[pre] == '*' && s[n - suf - 1] == '*' && pre - 1 < m - suf)
    puts("YES");
  else
    puts("NO");
  return 0;
}
