#include <bits/stdc++.h>
using std::pair;
using std::string;
using std::vector;
template <typename T>
inline bool chkmin(T& a, T b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T& a, T b) {
  return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
template <typename T>
T read(T& x) {
  T f = 1;
  x = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
  return x *= f;
}
int n, m;
string s, t;
int main() {
  read(n), read(m);
  std::cin >> s >> t;
  int l = -1, r = m;
  for (int i = 0; i < n && s[i] != '*'; ++i) {
    ++l;
    if (l >= m || s[i] != t[l]) return puts("NO"), 0;
    if (i == n - 1) return puts(s == t ? "YES" : "NO"), 0;
  }
  for (int i = n - 1; i >= 0 && s[i] != '*'; --i) {
    --r;
    if (r < 0 || s[i] != t[r]) return puts("NO"), 0;
  }
  puts(l < r ? "YES" : "NO");
  return 0;
}
