#include <bits/stdc++.h>
using namespace std;
void File() {
  freopen("a.in", "r", stdin);
  freopen("a.out", "w", stdout);
}
const int maxn = 2e5 + 10;
int n, m, tp, tp1;
char a[maxn], b[maxn];
int main() {
  scanf("%d%d", &n, &m);
  scanf("%s%s", a + 1, b + 1);
  tp = 1;
  while (a[tp] == b[tp] && tp <= n && tp <= m) ++tp;
  if (n == m && tp == n + 1) {
    puts("YES");
    return 0;
  } else if (a[tp] != '*') {
    puts("NO");
    return 0;
  }
  --tp;
  while (a[n - tp1] == b[m - tp1] && n - tp1 > tp && m - tp1 > tp) ++tp1;
  if (a[n - tp1] != '*') {
    puts("NO");
    return 0;
  }
  puts("YES");
  return 0;
}
