#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
int main(void) {
  int num1, num2, len1, len2;
  scanf("%d %d", &num1, &num2);
  len1 = num1;
  len2 = num2;
  string str1, str2;
  cin >> str1 >> str2;
  if (len1 - len2 >= 2) {
    cout << "NO";
    return 0;
  }
  for (int i = 0;; i++) {
    if (str1[i] == '*' || i == str1.length() - 1 || i == str2.length() - 1) {
      break;
    }
    if (str1[i] != str2[i] && str1[i] != '*') {
      cout << "NO\n";
      return 0;
    }
  }
  for (int i = 0;; i++) {
    if (str1[len1 - 1] == '*' || len1 < 0 || len2 < 0) break;
    if (str1[len1 - 1] != str2[len2 - 1] && str1[len1 - 1] != '*') {
      cout << "NO\n";
      return 0;
    }
    len1--, len2--;
  }
  cout << "YES";
  return 0;
}
