#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &a) {
  T ret(0), f(1);
  char ch(getchar());
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    ret = (ret << 2) + ret, ret += ret + (ch ^ 48);
    ch = getchar();
  }
  a = ret * f;
}
inline int Max(int x, int y) { return x > y ? x : y; }
inline int Min(int x, int y) { return x < y ? x : y; }
char a[200005], b[200005];
int main() {
  int n, m, d, pos(1);
  bool f(1);
  read(n), read(m);
  scanf("%s%s", a + 1, b + 1);
  if (m < n - 1)
    f = 0;
  else {
    for (int i(1); i <= n; i++) {
      if (a[i] == '*') {
        d = i + m - n + 1;
        if (i == d) continue;
        for (int j(i); j < d; j++)
          if (b[i] < 'a' || b[i] > 'z') {
            f = 0;
            break;
          }
        if (!f) break;
        pos = d;
      } else {
        if (a[i] != b[pos]) {
          f = 0;
          break;
        }
        ++pos;
      }
    }
  }
  if (pos != m + 1) f = 0;
  printf("%s", f ? "YES" : "NO");
  return 0;
}
