#include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
char s1[maxn], s2[maxn];
int main() {
  int m, n;
  scanf("%d %d\n", &n, &m);
  scanf("%s\n%s", s1 + 1, s2 + 1);
  if (n > m + 1) {
    printf("NO");
    return 0;
  }
  int pos = -1;
  bool flag = true;
  for (int i = 1; i <= n; i++) {
    if (s1[i] == '*') {
      pos = i;
      break;
    }
    if (i <= m && s1[i] != s2[i]) {
      flag = false;
      break;
    }
  }
  if (!flag) {
    printf("NO");
    return 0;
  }
  if (pos == -1) {
    if (n != m) {
      printf("NO");
    } else {
      for (int i = 1; i <= n; i++) {
        if (s1[i] != s2[i]) {
          printf("NO");
          return 0;
        }
      }
      printf("YES");
    }
    return 0;
  }
  for (int i = n, j = m; i > pos; i--, j--) {
    if (s1[i] != s2[j]) {
      printf("NO");
      return 0;
    }
  }
  printf("YES");
  return 0;
}
