#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
long long a[N];
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;
  int flag = 0, who;
  if (m + 1 < n) {
    return cout << "NO", 0;
  }
  for (int i = 0; i < n; i++)
    if (s[i] == '*') {
      flag = 1;
      who = i;
    }
  if (!flag) {
    if (s == t)
      return cout << "YES", 0;
    else
      return cout << "NO", 0;
  }
  string lt, rt, lt1, rt1;
  lt = t.substr(0, who);
  lt1 = s.substr(0, who);
  reverse(s.begin(), s.end());
  reverse(t.begin(), t.end());
  for (int i = 0; i < n; i++)
    if (s[i] == '*') {
      who = i;
    }
  rt = t.substr(0, who);
  rt1 = s.substr(0, who);
  if (rt == rt1 && lt == lt1) {
    return cout << "YES", 0;
  }
  cout << "NO";
  return 0;
}
