#include <bits/stdc++.h>
using namespace std;
int m, n;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> m >> n;
  string s, t;
  cin >> s;
  cin >> t;
  int wildcard = -1;
  int yes = 1;
  for (int i = 0; i < m; ++i)
    if (s[i] == '*') wildcard = i;
  if (!~wildcard && s != t) yes = 0;
  for (int i = 0; i < wildcard; ++i) {
    if (i >= n)
      yes = 0;
    else if (s[i] != t[i])
      yes = 0;
  }
  for (int i = m - 1, j = n - 1; i > wildcard; --i, --j) {
    if (j < 0) {
      yes = 0;
      break;
    }
    if (j < wildcard)
      yes = 0;
    else if (s[i] != t[j])
      yes = 0;
  }
  string ans = yes ? "YES" : "NO";
  cout << ans << "\n";
  return 0;
}
