#include <bits/stdc++.h>
using namespace std;
const int mod = 100;
const int maxn = 200005;
char s[maxn], t[maxn];
int main() {
  bool flag1, flag2, br;
  br = flag1 = flag2 = false;
  int i, j, n, m;
  scanf("%d%d", &n, &m);
  scanf("%s", s);
  scanf("%s", t);
  if (n > m + 1) {
    printf("NO\n");
    return 0;
  } else {
    int cnt_s = 0, cnt_t = 0;
    while (s[cnt_s] == t[cnt_t] && cnt_s < n && cnt_t < m) {
      cnt_s++;
      cnt_t++;
    }
    if (cnt_s == n && cnt_t == m) {
      printf("YES\n");
      return 0;
    }
    if (cnt_s == n) {
      printf("NO\n");
      return 0;
    }
    if (s[cnt_s] == '*')
      ;
    else {
      printf("NO\n");
      return 0;
    }
    cnt_s = n - 1;
    cnt_t = m - 1;
    while (s[cnt_s] == t[cnt_t]) {
      cnt_s--;
      cnt_t--;
    }
    if (s[cnt_s] == '*') {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}
