#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int mul_mod(int a, int b, int m) {
  int x = 0, y = a;
  while (b > 0) {
    if (b & 1) {
      x = (x + y) % m;
    }
    y = (y + y) % m;
    b >>= 1;
  }
  return x;
}
long long int power(long long int x, long long int y) {
  long long int res = 1;
  x = x;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  int n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  int f = 0;
  if (m < n - 1) {
    cout << "NO";
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (s[i] == '*') {
      f = 1;
      break;
    }
  }
  if (f == 0) {
    if (n != m) {
      cout << "NO";
      return 0;
    } else {
      for (int i = 0; i < n; i++) {
        if (s[i] != t[i]) {
          cout << "NO";
          return 0;
        }
      }
      cout << "YES";
      return 0;
    }
  }
  int i = 0;
  int j = 0;
  while (i < n && s[i] != '*' && j < m) {
    if (s[i] != t[j]) {
      cout << "NO";
      return 0;
    } else {
      i++;
      j++;
    }
  }
  i = n - 1;
  j = m - 1;
  while (i >= 0 && s[i] != '*' && j >= 0) {
    if (s[i] != t[j]) {
      cout << "NO";
      return 0;
    } else {
      i--;
      j--;
    }
  }
  cout << "YES";
  return 0;
}
