Charmander has a magical string s whose length is n.
At each second, every character in string s expands simultaneously, where character i will become the string Si. That means if the string contains 3 characters c1, c2 and c3, in next second the string will become .
But at any moment, each character that appears in string s can only be one of the m characters numbered from 1 to m.
Given a target string t, Charmander wants to know in which second it first appears as a substring of string s, or if it never appears?