#include <bits/stdc++.h>
using namespace std;
int n, m;
string s, t;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> s >> t;
  if (s == t) {
    cout << "YES\n";
    exit(0);
  }
  bool ok = false;
  for (auto u : s)
    if (u == '*') ok = true;
  if (!ok)
    cout << "NO\n";
  else {
    if (s.length() - 1 > t.length()) {
      cout << "NO\n";
      exit(0);
    }
    string s1, s2;
    for (int i = 0; i < n; i++) {
      if (s[i] == '*') {
        s1 = s.substr(0, i);
        s2 = s.substr(i + 1, n - (i + 1));
      }
    }
    for (int i = 0; i < s1.length(); i++) {
      if (s1[i] != t[i]) {
        cout << "NO\n";
        exit(0);
      }
    }
    reverse(t.begin(), t.end());
    reverse(s2.begin(), s2.end());
    for (int i = 0; i < s2.length(); i++) {
      if (s2[i] != t[i]) {
        cout << "NO\n";
        exit(0);
      }
    }
    cout << "YES\n";
  }
}
