#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string pertama, kedua;
  getline(cin, pertama);
  getline(cin, pertama);
  getline(cin, kedua);
  string pertama1, pertama2;
  bool masuk = false;
  for (int i = 0; i < pertama.length(); i++) {
    if (pertama[i] == '*') masuk = true;
    if (!masuk) {
      pertama1 += pertama[i];
    } else if (pertama[i] != '*') {
      pertama2 += pertama[i];
    }
  }
  if (pertama == "*") {
    cout << "YES" << endl;
    exit(0);
  } else if (!masuk) {
    if (pertama == kedua) {
      cout << "YES" << endl;
      exit(0);
    } else {
      cout << "NO" << endl;
      exit(0);
    }
  } else if (n - 1 <= m) {
    if (pertama1.length() > 0 && pertama2.length() > 0) {
      string temp = "", temp2 = "";
      temp = kedua.substr(0, pertama1.length());
      temp2 =
          kedua.substr(kedua.length() - pertama2.length(), pertama2.length());
      if (temp == pertama1 && pertama2 == temp2) {
        cout << "YES" << endl;
        exit(0);
      } else {
        cout << "NO" << endl;
        exit(0);
      }
    } else if (pertama1.length() > 0) {
      string temp = "";
      temp = kedua.substr(0, pertama1.length());
      if (temp == pertama1) {
        cout << "YES" << endl;
        exit(0);
      } else {
        cout << "NO" << endl;
        exit(0);
      }
    } else if (pertama2.length() > 0) {
      string temp = "";
      temp =
          kedua.substr(kedua.length() - pertama2.length(), pertama2.length());
      if (temp == pertama2) {
        cout << "YES" << endl;
        exit(0);
      } else {
        cout << "NO" << endl;
        exit(0);
      }
    }
  } else {
    cout << "NO" << endl;
    exit(0);
  }
}
