#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, ans = 1;
  string s, t, s1, s2, t1, t2;
  cin >> n >> m >> s >> t;
  int i = 0, j = 0, idx = -1;
  for (int k = 0; k < n; k++) {
    if (s[k] == '*') {
      idx = k;
    }
  }
  if (idx == -1) {
    if (s == t)
      ans = 1;
    else
      ans = 0;
  } else if (n > m + 1) {
    ans = 0;
  } else {
    while (i < n && j < m && i < idx) {
      if (s[i] == t[j]) {
        i++;
        j++;
      } else {
        ans = 0;
        break;
      }
    }
    i = n - 1;
    j = m - 1;
    while (i > 0 && j > 0 && i > idx) {
      if (s[i] == t[j]) {
        i--;
        j--;
      } else {
        ans = 0;
        break;
      }
    }
  }
  if (ans == 1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
