#include <bits/stdc++.h>
using namespace std;
long long dbg = 0;
template <typename A, typename B>
ostream& operator<<(ostream& cout, pair<A, B> const& p);
template <typename A>
ostream& operator<<(ostream& cout, vector<A> const& v);
template <typename A, typename B>
istream& operator>>(istream& cin, pair<A, B>& p);
template <typename A>
istream& operator>>(istream& cin, vector<A>& v);
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
void solve() {
  long long n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  if (s.size() - 1 > t.size()) {
    cout << "NO" << '\n';
    return;
  }
  long long ind = find(s.begin(), s.end(), '*') - s.begin();
  if (ind == n) {
    if (s == t)
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
    ;
    return;
  }
  if (s.substr(0, ind) == t.substr(0, ind) &&
      s.substr(ind + 1) == t.substr(max(ind, m - (n - ind - 1))))
    cout << "YES" << '\n';
  else
    cout << "NO" << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
template <typename A, typename B>
ostream& operator<<(ostream& cout, pair<A, B> const& p) {
  if (dbg) {
    dbg = 0;
    return cout << "(" << p.first << ", " << p.second << ")";
  } else {
    return cout << p.first << ' ' << p.second;
  }
}
template <typename A>
ostream& operator<<(ostream& cout, vector<A> const& v) {
  if (dbg) {
    dbg = 0;
    cout << "[";
    for (long long i = 0; i < v.size(); i++) {
      if (i) cout << ", ";
      cout << v[i];
    }
    return cout << "]";
  } else {
    for (long long i = 0; i < v.size() - 1; i++) cout << v[i] << ' ';
    return cout << v[v.size() - 1];
  }
}
template <typename A, typename B>
istream& operator>>(istream& cin, pair<A, B>& p) {
  cin >> p.first;
  return cin >> p.second;
}
template <typename A>
istream& operator>>(istream& cin, vector<A>& v) {
  for (long long i = 0; i < v.size() - 1; i++) cin >> v[i];
  return cin >> v[v.size() - 1];
}
