#include <bits/stdc++.h>
using namespace std;
signed main() {
  std::ios::sync_with_stdio(false);
  long long m, k, i, n, j, ind, l;
  string s, t, st1, st2, st3, st4;
  cin >> n >> m;
  ind = -1;
  cin >> s >> t;
  for (i = 0; i < s.size(); i++) {
    if (s[i] == '*') {
      ind = i;
      break;
    }
  }
  if (ind == -1) {
    if (s == t)
      cout << "YES";
    else
      cout << "NO";
    return 0;
  }
  l = s.size() - ind - 1;
  for (i = ind; i < t.size() - l; i++) st1 += t[i];
  st3 = s.substr(0, ind);
  st4 = s.substr(ind + 1, s.size());
  if (st3 + st1 + st4 == t)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
