#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  auto pos = s.find("*");
  bool ok = false;
  if (pos == string::npos)
    ok = s == t;
  else {
    int left = (int)s.size() - pos - 1;
    if (t.size() + 1 >= s.size() && s.substr(0, pos) == t.substr(0, pos) &&
        s.substr(s.size() - left) == t.substr(t.size() - left))
      ok = true;
  }
  cout << (ok ? "YES" : "NO") << endl;
}
