#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldb = long double;
struct init {
  init() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);
  }
  ~init() {
    cerr << "Time elapsed: " << (double)clock() / CLOCKS_PER_SEC << "s.\n";
  }
} init;
const long long N = 100500 * 1, MOD = 1000 * 1000 * 1000 + 7;
const ldb EPS = 5e-12, HALF = 0.5;
long long n, m;
string s, t;
signed main() {
  cin >> n >> m;
  cin >> s >> t;
  if (s.find('*') == string::npos) {
    if (s.size() != t.size()) {
      cout << "NO\n";
      return 0;
    }
  } else {
    if (s.size() > t.size() + 1) {
      cout << "NO\n";
      return 0;
    }
  }
  long long pos = 0;
  bool fl = 1;
  while (pos < s.size() && s[pos] != '*') {
    if (s[pos] != t[pos]) {
      fl = 0;
      break;
    }
    ++pos;
  }
  pos = 0;
  while (pos < s.size() && s[s.size() - pos] != '*') {
    if (s[s.size() - pos] != t[t.size() - pos]) {
      fl = 0;
      break;
    }
    ++pos;
  }
  if (fl) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
}
