#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, m, k;
char a[N], b[N];
int main() {
  scanf("%d%d", &n, &m);
  scanf("%s%s", a + 1, b + 1);
  k = -1;
  for (int i = 1; i <= n; ++i) {
    if (a[i] == '*') k = i;
  }
  if (n > m + 1) return puts("NO"), 0;
  if (k == -1) {
    if (n != m) return puts("NO"), 0;
    for (int i = 1; i <= n; ++i) {
      if (a[i] != b[i]) return puts("NO"), 0;
    }
    return puts("YES"), 0;
  }
  for (int i = 1; i < k; ++i) {
    if (a[i] != b[i]) return puts("NO"), 0;
  }
  for (int i = n; i > k; --i) {
    if (b[m - n + i] != a[i]) return puts("NO"), 0;
  }
  puts("YES");
  return 0;
}
