#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, k, cnt1, cnt2;
  scanf("%d %d", &n, &m);
  string str1, str2;
  cin >> str1 >> str2;
  if (str1 == str2) {
    return !printf("YES\n");
  }
  cnt1 = cnt2 = 0;
  int l2;
  for (i = 0; i < n && i < m; i++) {
    if (str1[i] == str2[i]) {
      cnt1++;
    } else {
      l2 = i;
      break;
    }
  }
  for (i = n - 1, j = m - 1; i >= 0 && j >= l2; i--, j--) {
    if (str1[i] == str2[j]) {
      cnt2++;
    } else {
      break;
    }
  }
  bool ok = 0;
  for (i = 0; i < n; i++)
    if (str1[i] == '*') ok = 1;
  if (cnt1 + cnt2 + 1 == n && ok)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
