#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 15;
char s[MAXN], t[MAXN];
int n, m, tag;
inline int read() {
  int r = 0, z = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') z = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    r = r * 10 + ch - '0';
    ch = getchar();
  }
  return r * z;
}
void work() {
  n = read(), m = read();
  scanf("%s %s", s + 1, t + 1);
  tag = -1;
  for (int i = 1; i <= n; i++)
    if (s[i] == '*') tag = i;
  if (tag == -1) {
    if (n != m) {
      puts("NO");
      return;
    }
    for (int i = 1; i <= n; i++)
      if (s[i] != t[i]) {
        puts("NO");
        return;
      }
    puts("YES");
    return;
  }
  for (int i = 1; i < tag; i++)
    if (s[i] != t[i]) {
      puts("NO");
      return;
    }
  for (int i = tag + 1; i <= n; i++) {
    int j = m - n + tag + 1 + (i - tag) - 1;
    if (s[i] != t[j] || j > m || j < tag) {
      puts("NO");
      return;
    }
  }
  puts("YES");
}
int main() {
  work();
  return 0;
}
