#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
string a, b;
int main() {
  int n, m;
  cin >> n >> m;
  cin >> a >> b;
  if (a == b) {
    printf("YES\n");
    return 0;
  }
  int p = a.find('*');
  if (p == -1) {
    printf("NO\n");
    return 0;
  }
  if (m + 1 < n) {
    printf("NO\n");
    return 0;
  }
  int f = 1;
  for (int i = 0; i < p; i++) {
    if (a[i] != b[i]) {
      f = 0;
      break;
    }
  }
  for (int i = n - 1; i > p; i--) {
    if (a[i] != b[m + i - n]) {
      f = 0;
      break;
    }
  }
  if (f)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
