#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  if (n - 1 > m) {
    cout << "NO";
    return 0;
  }
  int y = -1;
  for (int i = 0; i < n; i++) {
    if (s[i] != t[i]) {
      y = i;
      break;
    }
  }
  if (y == -1) {
    if (n == m) {
      cout << "YES";
      return 0;
    } else {
      cout << "NO";
      return 0;
    }
  }
  int z = 0, z2 = 0, b = m - 1;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] != t[b]) {
      z = i;
      z2 = b;
      break;
    }
    b--;
  }
  if (z == y && s[y] == '*') {
    cout << "YES";
    return 0;
  } else {
    cout << "NO";
  }
  return 0;
}
