#include <bits/stdc++.h>
using namespace std;
long long mM(long long a, long long b, long long mod) {
  long long res = 0;
  a %= mod;
  while (b) {
    if (b & 1) res = (res + a) % mod;
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}
long long fpow(long long first, long long second, long long p) {
  first = first % p;
  long long res = 1;
  while (second) {
    if (second & 1) res = mM(res, first, p);
    res %= p;
    if (res < 0) res = (res + p) % p;
    second = second >> 1;
    first = mM(first, first, p);
    if (first < 0) first = (first + p) % p;
    first %= p;
  }
  return res;
}
long long inv(long long n) { return fpow(n, 1000000007 - 2, 1000000007); }
long long modmul(long long first, long long second) {
  return mM(first, second, 1000000007);
}
long long modadd(long long first, long long second) {
  long long temp = first % 1000000007 + second % 1000000007;
  temp %= 1000000007;
  if (temp < 0) temp = (temp + 1000000007) % 1000000007;
  return temp;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    string s, p;
    cin >> s >> p;
    string s1 = "", s2 = "";
    for (int i = 0; i < s.size(); i++)
      if (s[i] != '*')
        s1 += s[i];
      else
        break;
    for (int i = n - 1; i >= 0; i--)
      if (s[i] != '*')
        s2 += s[i];
      else
        break;
    if (s == p) {
      cout << "YES\n";
      return 0;
    }
    string jk = s2;
    reverse(jk.begin(), jk.end());
    if (s1 == s && jk == s && s != p) {
      cout << "NO\n";
      return 0;
    }
    if (s1.size() + s2.size() > p.size()) {
      cout << "NO\n";
      return 0;
    }
    int i;
    for (i = 0; i < s1.size(); i++)
      if (s1[i] != p[i]) break;
    int j, k = m - 1;
    for (j = 0; j < s2.size(); j++)
      if (s2[j] != p[k])
        break;
      else
        k--;
    if (i != s1.size() || j != s2.size())
      cout << "NO\n";
    else
      cout << "YES\n";
  }
}
