A newspaper is published in Walrusland. Its heading is s1, 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 s2. 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 s1 will Fangy need to glue them, erase several letters and get word s2?

Input

The input data contain two lines. The first line contain the heading s1, the second line contains the word s2. The lines only consist of lowercase Latin letters (1 ≤ |s1| ≤ 104, 1 ≤ |s2| ≤ 106).

Output

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

Examples

Input

abc
xyz


Output

-1


Input

abcd
dabc


Output

2


import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

/**
 * @author Ivan Pryvalov (ivan.pryvalov@gmail.com)
 *
 */
public class C implements Runnable{
	

	private void solve() throws IOException {
		char[] a1 = nextToken().toCharArray();
		char[] a2 = nextToken().toCharArray();
		char A = 'a';
		
		int next[][] = new int[a1.length][26];
		for (int i = a1.length-1; i>=0; i--) {
			for (int j = 0; j < 26; j++) {
				next[i][j] = (i<a1.length-1)? next[i+1][j] : -1;
			}
			next[i][a1[i]-A]=i;
		}
		
		int answer = 1, pos=0;
		for (int i = 0; i < a2.length; i++) {
			if (pos>=a1.length || (a2[i]!=a1[pos] && next[pos][a2[i]-A]==-1)){
				pos=0;
				answer++;
			}
			if (a2[i]!=a1[pos] && next[pos][a2[i]-A]==-1){
				answer = -1;
				break;
			}
			if (a2[i]!=a1[pos])
				pos = next[pos][a2[i]-A];
			pos++;
		}
		out.println(answer);
	}

	/////////////////////////////////////////////////
	boolean inputFromFile = false;
	String filenamePrefix = "input-large";
	String inSuffix = ".in";
	String outSuffix = ".out";
	
	BufferedInputStream bis;
	BufferedOutputStream bos;
	PrintStream out;
	
	final static byte ZERO = '0';//48 or 0x30
	final static byte NINE = '9';
	final static byte SPACEBAR = ' '; //32 or 0x20
	final static byte MINUS = '-'; //45 or 0x2d	
	
	final static char FLOAT_POINT = '.';
	
	@Override
	public void run() {
		try{
			if (inputFromFile){
				File baseFile = new File(getClass().getResource("/").getFile());
				bis = new BufferedInputStream(
						new FileInputStream(new File(
								baseFile, filenamePrefix+inSuffix)),
								INPUT_BUFFER_SIZE);
				bos = new BufferedOutputStream(
						new FileOutputStream(
								new File(baseFile, filenamePrefix+outSuffix)));
				out = new PrintStream(bos);
			}else{
				bis = new BufferedInputStream(System.in, INPUT_BUFFER_SIZE);
				bos = new BufferedOutputStream(System.out);
				out = new PrintStream(bos);
			}
			solve();
			out.flush();
		}catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
	
	final int INPUT_BUFFER_SIZE = 1024 * 1024 * 8 ;
	final int BUF_SIZE_INPUT = INPUT_BUFFER_SIZE;
	final int BUF_SIZE = 1024 * 1024 * 8;
	byte[] byteBufInput = new byte[BUF_SIZE_INPUT];
	byte by=-1;
	int byteRead=-1;
	int bytePos=-1;
	
	byte[] byteBuf = new byte[BUF_SIZE];
	int totalBytes;
	
	private byte nextByte() throws IOException{
		if (bytePos<0 || bytePos>=byteRead){
			byteRead = bis.read(byteBufInput);
			bytePos=0;
			if (byteRead<0)
				byteBufInput[bytePos]=0;//!!!
		}
		return byteBufInput[bytePos++];
	}
	
	public void writeUnsignedInt(int num) throws IOException{
		int byteWriteOffset = byteBuf.length;
		if (num==0){
			byteBuf[--byteWriteOffset] = ZERO;
		}else{
			while (num>0){
				byteBuf[--byteWriteOffset] = (byte)((num % 10) + ZERO);
				num /= 10;
			}	
		}
		bos.write(byteBuf, byteWriteOffset, byteBuf.length - byteWriteOffset);
	}
	
	public void writeSpaceBar() throws IOException{
		byteBuf[0] = SPACEBAR;
		bos.write(byteBuf,0,1);
	}
	
	/*
	//TODO test Unix/Windows formats
	public void toNextLine() throws IOException{
		while ((ch=nextChar())!='\n');
	}
	
	//[0-9.-] eE?
	public double nextDouble() throws IOException{
		while (((ch=nextChar())<'0' || ch>'9') && ch!=FLOAT_POINT && ch!='-');
		char[] tmp = new char[255];
		int itmp = 0;
		tmp[itmp++]=(char)ch;
		while (((ch=nextChar())>='0' && ch<='9') || ch==FLOAT_POINT || ch=='-'){
			tmp[itmp++]=(char)ch;
		}
		return Double.parseDouble(new String(tmp,0,itmp));
	}
	*/
	
	/**
	 * Returns next meaningful character as a byte.<br>
	 * 
	 * @return
	 * @throws IOException
	 */
	public byte nextChar() throws IOException{
		while ((by=nextByte())<=0x20);
		return by;
	}
	
	/**
	 * Returns next meaningful character OR space as a byte.<br>
	 * 
	 * @return
	 * @throws IOException
	 */
	public byte nextCharOrSpacebar() throws IOException{
		while ((by=nextByte())<0x20);
		return by;
	}

	/**
     * Spacebar is included as separator char
     * 
     * @throws IOException
     */
    private void readToken() throws IOException {
            readToken((byte)0x21);
    }
    
    /**
     * Reads line.
     * 
     * @return
     * @throws IOException
     */
    public String nextLine() throws IOException {
            readToken((byte)0x20);
            return new String(byteBuf,0,totalBytes);
    }
    
    public int readLine(byte ar[]) throws IOException {
        readToken((byte)0x20);
        for (int i = 0; i < totalBytes; i++) {
			ar[i] = byteBuf[i];
		}
        return totalBytes; 
    }
    
    /**
     * Reads token. Spacebar is separator char.
     * 
     * @return
     * @throws IOException
     */
    public String nextToken() throws IOException {
            readToken((byte)0x21);
            return new String(byteBuf,0,totalBytes);
    }
    
    private void readToken(byte acceptFrom) throws IOException {
            totalBytes = 0;
            while ((by=nextByte())<acceptFrom);
            byteBuf[totalBytes++] = by;
            while ((by=nextByte())>=acceptFrom){
                    byteBuf[totalBytes++] = by;
            }
    }
	
	public int nextInt() throws IOException{
		readToken();
		int num=0, i=0;
		boolean sign=false;
		if (byteBuf[i]==MINUS){
			sign = true;
			i++;
		}
		for (; i<totalBytes; i++){
			num*=10;
			num+=byteBuf[i]-ZERO;
		}
		return sign?-num:num;
	}
	
	public long nextLong() throws IOException{
		readToken();
		long num=0;
		int i=0;
		boolean sign=false;
		if (byteBuf[i]==MINUS){
			sign = true;
			i++;
		}
		for (; i<totalBytes; i++){
			num*=10;
			num+=byteBuf[i]-ZERO;
		}
		return sign?-num:num;
	}
	
	public static void main(String[] args) {
		new C().run();
	}
	
}
