#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  if (n > m + 1) {
    cout << "NO" << endl;
    return 0;
  }
  string s, t;
  cin >> s >> t;
  int index = -1;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '*') index = i;
  }
  if (~index) {
    string a = s.substr(0, index);
    string b = s.substr(index + 1);
    int i;
    for (i = 0; i < a.length(); i++) {
      if (t[i] != a[i]) {
        cout << "NO" << endl;
        return 0;
      }
    }
    int j;
    for (j = 0; j < b.length(); j++) {
      if (s[n - j - 1] != t[m - j - 1]) {
        cout << "NO" << endl;
        return 0;
      }
    }
    cout << "YES" << endl;
  } else {
    if (s == t) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
