#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  string s, t;
  cin >> n >> m >> s >> t;
  if (s.find('*') == -1 && s != t) {
    cout << "NO\n";
    return 0;
  }
  while (s.size() && t.size() && s[0] == t[0]) {
    s.erase(s.begin());
    t.erase(t.begin());
  }
  while (s.size() && t.size() && s[s.size() - 1] == t[t.size() - 1]) {
    s.erase(s.begin() + s.size() - 1);
    t.erase(t.begin() + t.size() - 1);
  }
  if (s == "*" || s == "")
    cout << "YES\n";
  else
    cout << "NO\n";
}
