Problem1479--CF91 - A. Newspaper Headline

1479: CF91 - A. Newspaper Headline

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

A newspaper is published in Walrusland. Its heading is $s_1$, it consists of lowercase Latin letters. Fangy the little walrus wants to buy several such newspapers, cut out their headings, glue them one to another in order to get one big string. After that walrus erase several letters from this string in order to get a new word $s_2$. It is considered that when Fangy erases some letter, there's no whitespace formed instead of the letter. That is, the string remains unbroken and it still only consists of lowercase Latin letters.
For example, the heading is "abc". If we take two such headings and glue them one to the other one, we get "abcabc". If we erase the letters on positions $1$ and $5$, we get a word "bcac".
Which least number of newspaper headings $s_1$ will Fangy need to glue them, erase several letters and get word $s_2$?

Input

The input data contain two lines. 
The first line contain the heading $s_1$, 
the second line contains the word $s_2$. 
The lines only consist of lowercase Latin letters $(1≤|s_1|≤10^4,\ 1≤|s_2|≤10^6)$.

Output

If it is impossible to get the word $s_2$ in the above-described manner, print "-1" (without the quotes). Otherwise, print the least number of newspaper headingss1, which Fangy will need to receive the word $s_2$.

Sample 1 Input

abc
xyz

Sample 1 Output

-1

Sample 2 Input

abcd
dabc

Sample 2 Output

2

HINT

CF91.

Source/Category