#include <bits/stdc++.h>
int main() {
  int n, m, p = 0;
  ;
  std::cin >> n >> m;
  std::string s, t;
  std::cin >> s >> t;
  int f = 0, pp = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] != t[i] && s[i] != '*') {
      p = 1;
      break;
    }
    if (s[i] != t[i]) {
      f = i;
      pp = 1;
      break;
    }
  }
  if (!pp) {
    if (s != t) p = 1;
  }
  for (int i = n - 1, j = m - 1; i > f; i--, j--) {
    if (s[i] != t[j] || j < f) {
      p = 1;
      break;
    }
  }
  if (p)
    std::cout << "NO\n";
  else
    std::cout << "YES\n";
}
