#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, i, pos = -1, flag;
  string s1, s2;
  cin >> n >> m;
  cin >> s1;
  cin >> s2;
  for (i = 0; i < n; i++) {
    if (s1[i] == '*') {
      pos = i;
      break;
    }
  }
  if (pos == -1) {
    if (s1 == s2)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  } else {
    if (m < (n - 1))
      cout << "NO" << endl;
    else {
      flag = 0;
      for (i = 0; i < n; i++) {
        if (i < pos) {
          if (s1[i] != s2[i]) {
            cout << "NO" << endl;
            flag = 1;
            break;
          }
        } else if (i > pos) {
          if (s1[i] != s2[m - n + i]) {
            cout << "NO" << endl;
            flag = 1;
            break;
          }
        }
      }
      if (flag == 0) cout << "YES" << endl;
    }
  }
  return 0;
}
