#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
int main() {
  string a, b;
  int n, m, i, j, f, star;
  while (scanf("%d %d", &n, &m) == 2) {
    cin >> a;
    cin >> b;
    f = 1;
    star = 0;
    if (n > (m + 1)) f = 0;
    for (i = 0; i < n; i++)
      if (a[i] == '*') star = 1;
    for (i = 0, j = 0; i < n && j < m && f; i++, j++) {
      if (a[i] == '*') break;
      if (a[i] != b[j]) {
        f = 0;
        break;
      }
    }
    if (f && i < n && j < m)
      for (i = n - 1, j = m - 1; i >= 0 && j >= 0; i--, j--) {
        if (a[i] == '*') break;
        if (a[i] != b[j]) {
          f = 0;
          break;
        }
      }
    if (star == 0 && a == b)
      printf("YES\n");
    else if (f && star == 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
