#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll a, b, n, m;
  ll flag[100001];
  memset(flag, 0, sizeof(0));
  string s, t;
  cin >> n >> m;
  cin >> s >> t;
  ll c = 0;
  for (ll i = 0; i < n; i++) {
    if (s[i] == '*') c++;
  }
  if (c == 0) {
    if (n != m) {
      cout << "NO";
      return 0;
    } else {
      for (ll i = 0; i < n; i++) {
        if (s[i] != t[i]) c++;
      }
      if (c > 0) {
        cout << "NO";
        return 0;
      } else {
        cout << "YES";
        return 0;
      }
    }
  } else {
    c = 0;
    for (ll i = 0; i < n; i++) {
      if (n - 1 > m) {
        cout << "NO";
        return 0;
      }
      if (s[i] != '*') {
        if (s[i] != t[i]) c++;
      } else {
        if (i == n - 1) {
          if (c > 0)
            cout << "NO";
          else
            cout << "YES";
          return 0;
        }
        i++;
        for (ll j = m - n + i; j < m; j++) {
          if (s[i++] != t[j]) c++;
        }
        if (c > 0) {
          cout << "NO";
          return 0;
        } else {
          cout << "YES";
          return 0;
        }
      }
    }
  }
  return 0;
}
