#include <bits/stdc++.h>
using namespace std;
char a[200200];
char b[200200];
int alen;
int blen;
int xlen;
int js(int s) {
  int ansjs = 0;
  for (int i = 0; i <= s; i++) {
    if (a[i] != b[i]) {
      ansjs++;
    }
  }
  return ansjs;
}
int je(int e) {
  int ansjs = 0;
  for (int i = e; i < alen; i++) {
    if (a[i] != b[blen - (alen - i)]) {
      ansjs++;
    }
  }
  return ansjs;
}
int main() {
  scanf("%d%d", &alen, &blen);
  scanf("%s%s", a, b);
  xlen = -1;
  for (int i = 0; i < alen; i++) {
    if (a[i] == '*') {
      xlen = i;
      break;
    }
  }
  if ((alen > blen + 1)) {
    printf("NO\n");
    return 0;
  }
  if (xlen == -1) {
    if (alen == blen && !js(alen - 1)) {
      printf("YES\n");
      return 0;
    }
    printf("NO\n");
    return 0;
  }
  if (a[0] == '*') {
    if (!je(1)) {
      printf("YES\n");
      return 0;
    }
    printf("NO\n");
    return 0;
  }
  if (a[alen - 1] == '*') {
    if (!js(alen - 2)) {
      printf("YES\n");
      return 0;
    }
    printf("NO\n");
    return 0;
  } else {
    if (!js(xlen - 1) && (!je(xlen + 1))) {
      printf("YES\n");
      return 0;
    }
    printf("NO\n");
    return 0;
  }
}
