#include <bits/stdc++.h>
using namespace std;
string a, b, tmp;
int main(void) {
  int i, n, m, pos = 0x3F3F3F3F;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> a >> b;
  for (i = 0; i < n; ++i)
    if (a[i] == '*') pos = i;
  if (pos == 0x3F3F3F3F) {
    if (a == b)
      printf("YES\n");
    else
      printf("NO\n");
    return 0;
  }
  if (m < n - 1) {
    printf("NO\n");
    return 0;
  }
  tmp = a.substr(0, pos) + b.substr(pos, m - (n - 1)) +
        a.substr(pos + 1, n - pos - 1);
  if (tmp == b)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
