#abc257g. [abc257_g]Prefix Concatenation

[abc257_g]Prefix Concatenation

Problem Statement

You are given two strings SS and TT consisting of lowercase English letters.

Find the minimum positive integer kk such that you can choose (not necessarily distinct) kk prefixes of SS so that their concatenation coincides with TT.

In other words, find the minimum positive integer kk such that there exists a kk-tuple (a1,a2,ldots,ak)(a_1,a_2,\\ldots, a_k) of integers between 11 and S|S| such that
T=Sa1+Sa2+cdots+SakT=S_{a_1}+S_{a_2}+\\cdots +S_{a_k}, where SiS_i denotes the substring of SS from the 11-st through the ii-th characters and ++ denotes the concatenation of strings.

If it is impossible to make it coincide with TT, print \-1\-1 instead.

Constraints

  • 1leqSleq5times1051 \\leq |S| \\leq 5\\times 10^5
  • 1leqTleq5times1051 \\leq |T| \\leq 5\\times 10^5
  • SS and TT are strings consisting of lowercase English letters.

Input

Input is given from Standard Input in the following format:

SS TT

Output

Print the minimum positive integer kk such that you can choose kk prefixes of SS so that their concatenation coincides with TT. It is impossible to make it coincide with TT, print \-1\-1 instead.


Sample Input 1

aba
ababaab

Sample Output 1

3

T=T= ababaab can be written as ab + aba + ab, of which ab and aba are prefixes of S=S= aba.
Since it is unable to express ababaab with two or less prefixes of aba, print 33.


Sample Input 2

atcoder
ac

Sample Output 2

-1

Since it is impossible to express TT as a concatenation of prefixes of SS, print \-1\-1.