#include <bits/stdc++.h>
using namespace std;
int n, m;
char s[200010], t[200010];
int main() {
  scanf("%d %d", &n, &m);
  scanf(" %s", s);
  scanf(" %s", t);
  int as = -1;
  for (int i = 0; as == -1 && i < n; i++)
    if (s[i] == '*') as = i;
  if (as == -1) {
    if (n != m) {
      printf("NO\n");
      return 0;
    }
    for (int i = 0; i < n; i++)
      if (s[i] != t[i]) {
        printf("NO\n");
        return 0;
      }
    printf("YES\n");
    return 0;
  }
  if (m < n - 1) {
    printf("NO\n");
    return 0;
  }
  for (int i = 0; i < as; i++)
    if (s[i] != t[i]) {
      printf("NO\n");
      return 0;
    }
  for (int i = 0; n - i > as; i++)
    if (s[n - i] != t[m - i]) {
      printf("NO\n");
      return 0;
    }
  printf("YES\n");
  return 0;
}
