#include <bits/stdc++.h>
using namespace std;
const int maxn = 2 * 1e5 + 10;
char a[maxn], b[maxn], c[maxn];
int n, m;
int find() {
  int i, j = -1;
  for (i = 0; i < n; i++)
    if (a[i] == '*') {
      j = i;
      break;
    }
  return j;
}
int main() {
  cin >> n >> m;
  cin >> a;
  cin >> b;
  int n1 = find();
  if (n1 != -1) {
    for (int i = n1; i < n - 1; i++) a[i] = a[i + 1];
    for (int i = n - 1; i < maxn; i++) a[i] = '0';
    a[maxn] = '\0';
    if (n - 1 < m) {
      for (int i = 0; i < n1; i++) c[i] = b[i];
      int n2 = n - n1 - 1, n3 = m - n2;
      for (int i = n1; i < n1 + n2; i++) c[i] = b[n3++];
      for (int i = n1 + n2; i < maxn; i++) c[i] = '0';
      c[maxn] = '\0';
    } else {
      for (int i = 0; i < m; i++) c[i] = b[i];
      for (int i = m; i < maxn; i++) c[i] = '0';
      c[maxn] = '\0';
    }
    if (strcmp(a, c) == 0)
      printf("Yes");
    else
      printf("NO");
  } else {
    if (strcmp(a, b) == 0)
      printf("YES");
    else
      printf("NO");
  }
  return 0;
}
