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