#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, m, flag = 0, ff = 0, ia;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  if (m < (n - 1))
    cout << "NO";
  else if (m == (n - 1)) {
    for (i = 0; i < n; i++) {
      if (s[i] == '*') {
        flag = 1;
        break;
      }
    }
    if (!flag)
      cout << "NO";
    else {
      s.erase(std::find(s.begin(), s.end(), '*'));
      if (s == t)
        cout << "YES";
      else
        cout << "NO";
    }
  } else {
    if (s == t)
      cout << "YES";
    else {
      for (i = 0; i < n; i++) {
        if (s[i] == '*') {
          ia = i;
          flag = 1;
          break;
        }
        if (s[i] != t[i]) {
          ff = 1;
          break;
        }
      }
      if (ff)
        cout << "NO";
      else if (ff == 0 && flag == 0)
        cout << "NO";
      else {
        i = ia + (m - n) + 1;
        ia++;
        while (s[ia] == t[i] && ia < n) {
          ia++;
          i++;
        }
        if (ia == n)
          cout << "YES";
        else
          cout << "NO";
      }
    }
  }
}
