#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n, m, i = 0, x = 1;
  cin >> n >> m;
  string s, t;
  cin >> s;
  cin >> t;
  while (i < n) {
    if (s[i] == '*') break;
    i++;
  }
  if (i == (n)) {
    if (!s.compare(t))
      cout << "YES";
    else
      cout << "NO";
  } else {
    for (int j = 0; j < i; j++) {
      if (s[j] == t[j])
        continue;
      else {
        x = 0;
        break;
      }
    }
    if (x == 1) {
      int count = 0;
      while (count < (n - 1 - i)) {
        if ((n - 1 - i) > (m - i)) {
          x = 0;
          break;
        }
        if (s[n - 1 - count] == t[m - 1 - count]) {
          count++;
          continue;
        } else {
          x = 0;
          break;
        }
      }
    }
    if (x == 1)
      cout << "YES";
    else
      cout << "NO";
  }
  return 0;
}
