#include <bits/stdc++.h>
using namespace std;
int n, m;
char s[200001], t[200001];
int main(void) {
  cin >> n >> m >> s >> t;
  bool wild_card = false;
  for (int i = 0; i < n; i++) {
    if (s[i] == '*') {
      wild_card = true;
      break;
    }
  }
  if (wild_card) {
    if (n > m + 1) {
      cout << "NO" << endl;
      return 0;
    }
    for (int i = 0; i < n; i++) {
      if (s[i] == '*') break;
      if (s[i] != t[i]) {
        cout << "NO" << endl;
        return 0;
      }
    }
    for (int i = n - 1, j = m - 1; i >= 0; i--, j--) {
      if (s[i] == '*') break;
      if (s[i] != t[j]) {
        cout << "NO" << endl;
        return 0;
      }
    }
    cout << "YES" << endl;
  } else {
    if (n != m) {
      cout << "NO" << endl;
      return 0;
    }
    for (int i = 0; i < n; i++) {
      if (s[i] != t[i]) {
        cout << "NO" << endl;
        return 0;
      }
    }
    cout << "YES" << endl;
  }
}
