#include <bits/stdc++.h>
using namespace std;
bool doCheck(string s, string t) {
  for (int q = 0; q < 2; q++) {
    while (s.length() > 0) {
      if (s.back() == '*') {
        break;
      }
      if (t.length() == 0 || s.back() != t.back()) {
        return false;
      }
      s.pop_back();
      t.pop_back();
    }
    reverse(s.begin(), s.end());
    reverse(t.begin(), t.end());
  }
  return s.length() > 0 || t.length() == 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  string s, t;
  cin >> s >> t;
  bool ok = doCheck(s, t);
  cout << (ok ? "YES" : "NO") << endl;
}
