#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int i;
  int len1 = 0, len2 = 0;
  scanf("%d%d", &n, &m);
  string s, t;
  cin >> s >> t;
  if (n - 1 > m) {
    cout << "NO" << endl;
    return 0;
  }
  for (i = 0; i < n; i++)
    if (s[i] == '*') break;
  if (i == n && s != t) {
    cout << "NO" << endl;
    return 0;
  }
  int flag = 0;
  for (i = 0; i < n; i++) {
    if (s[i] == '*') break;
    if (s[i] != t[i]) {
      flag = 1;
      break;
    }
    len1++;
  }
  for (i = n - 1; i >= len1; i--) {
    if (s[i] == '*') break;
    if (s[i] != t[m - (n - i)]) {
      flag = 1;
      break;
    }
    len2++;
  }
  if (flag)
    cout << "NO" << endl;
  else {
    if (len1 + len2 <= m)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
