#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  string a, b;
  cin >> a >> b;
  if (a.size() - 1 > b.size()) {
    cout << "NO\n";
    return 0;
  }
  if (a == b) {
    cout << "YES\n";
    return 0;
  }
  int l = 0, r = m - 1;
  while (a[l] == b[l] && l < min(n, m)) l++;
  while (a.back() == b.back() && min(a.size(), b.size()) > l)
    a.pop_back(), b.pop_back();
  if (a.size() - l == 1 && a.back() == '*') {
    cout << "YES";
  } else {
    cout << "NO\n";
  }
  return 0;
}
