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