{"raw_statement":[{"iden":"problem statement","content":"You are given two strings: $S$, which consists of uppercase English letters and has length $N$, and $T$, which also consists of uppercase English letters and has length $M\\ (\\leq N)$.\nThere is a string $X$ of length $N$ consisting only of the character `#`. Determine whether it is possible to make $X$ match $S$ by performing the following operation any number of times:\n\n*   Choose $M$ consecutive characters in $X$ and replace them with $T$."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 2\\times 10^5$\n*   $1 \\leq M \\leq \\min(N,$ $5$$)$\n*   $S$ is a string consisting of uppercase English letters with length $N$.\n*   $T$ is a string consisting of uppercase English letters with length $M$."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $M$\n$S$\n$T$"},{"iden":"sample input 1","content":"7 3\nABCBABC\nABC"},{"iden":"sample output 1","content":"Yes\n\nBelow, let $X[l:r]$ denote the part from the $l$\\-th through the $r$\\-th character of $X$.\nYou can make $X$ match $S$ by operating as follows.\n\n1.  Replace $X[3:5]$ with $T$. $X$ becomes `##ABC##`.\n2.  Replace $X[1:3]$ with $T$. $X$ becomes `ABCBC##`.\n3.  Replace $X[5:7]$ with $T$. $X$ becomes `ABCBABC`."},{"iden":"sample input 2","content":"7 3\nABBCABC\nABC"},{"iden":"sample output 2","content":"No\n\nNo matter how you operate, it is impossible to make $X$ match $S$."},{"iden":"sample input 3","content":"12 2\nXYXXYXXYYYXY\nXY"},{"iden":"sample output 3","content":"Yes"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}