#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  bool nostar = true;
  for (int i = 0; i < n; i++) {
    if (s[i] == '*') nostar = false;
  }
  if (nostar) {
    if (s == t)
      cout << "YES";
    else
      cout << "NO";
    return 0;
  }
  if (n - 1 > m) {
    cout << "NO";
    return 0;
  }
  int start = 0;
  int i;
  for (i = 0; i < s.length(); i++) {
    if (s[i] == '*') {
      start--;
      break;
    }
    if (s[i] != t[start]) {
      cout << "NO";
      return 0;
    }
    start++;
  }
  int end = m - 1;
  for (i = n - 1; i >= 0; i--) {
    if (s[i] == '*') {
      end++;
      break;
    }
    if (s[i] != t[end]) {
      cout << "NO";
      return 0;
    }
    end--;
  }
  if (start <= end)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
