#include <bits/stdc++.h>
using namespace std;
long long n, m, k, ans, one, p[3005], x, b, flag, x1, y, c[3005], ans1,
    v1[3005];
vector<pair<long long, long long> > a, v;
vector<long long> l[3005];
pair<long long, long long> r;
int mp1[1000007], mp2[1000007];
string s, t;
bool func(pair<long long, long long> x, pair<long long, long long> y) {
  if (x.first != y.first) {
    return x.first > y.first;
  } else if (l[x.second].size() > 0 && l[y.second].size() > 0) {
    return l[x.second][l[x.second].size() - 1] <
           l[y.second][l[y.second].size() - 1];
  }
}
int main() {
  ios_base::sync_with_stdio();
  cin.tie(0);
  cin >> n >> m;
  cin >> s >> t;
  if (s == t) {
    cout << "YES";
    return 0;
  }
  if (n - 1 > m) {
    cout << "NO";
    return 0;
  }
  for (int i = 0; s[i] != '*'; i++) {
    if (s[i] != t[i]) {
      cout << "NO";
      return 0;
    }
  }
  for (int i = n - 1, j = m - 1; s[i] != '*'; i--, j--) {
    if (s[i] != t[j]) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
