#include <bits/stdc++.h>
using namespace std;
int n, m, pos, flag;
char a[200005], b[200005];
int main() {
  cin >> n >> m;
  scanf("%s", a);
  scanf("%s", b);
  if (n > m + 1) {
    cout << "NO" << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if ((a[i] < 'a' || a[i] > 'z') && a[i] != '*') {
      cout << "NO";
      return 0;
    }
    if (a[i] == '*' && flag == 0) {
      flag = 1;
      pos = i;
      continue;
    }
    if (a[i] == '*' && flag == 1) {
      cout << "NO" << endl;
      return 0;
    }
  }
  for (int i = 0; i < m; i++) {
    if (b[i] < 'a' || b[i] > 'z') {
      cout << "NO" << endl;
      return 0;
    }
  }
  if (flag == 0) {
    if (n != m) {
      cout << "NO" << endl;
      return 0;
    } else {
      for (int i = 0; i < n; i++) {
        if (a[i] != b[i]) {
          cout << "NO" << endl;
          return 0;
        }
      }
      cout << "YES" << endl;
      return 0;
    }
  }
  if (flag == 1) {
    for (int i = 0; i < pos; i++) {
      if (a[i] != b[i]) {
        cout << "NO" << endl;
        return 0;
      }
    }
    for (int i = 0; i < n - pos - 1; i++) {
      if (a[n - i - 1] != b[m - i - 1]) {
        cout << "NO" << endl;
        return 0;
      }
    }
    cout << "YES" << endl;
  }
  return 0;
}
