import java.io.BufferedReader import java.io.InputStream import java.io.InputStreamReader import java.lang.StringBuilder import java.util.* fun main(args: Array) { val sc = FastScanner(System.`in`) val s = sc.nextLine() val t = sc.nextLine() val count = (s.length - s.replace(t, "").length) / t.length if (count > 0 && t.length == 1) { println(-1) } else { println(count) } } class FastScanner(s: InputStream) { private var st = StringTokenizer("") private val br = BufferedReader(InputStreamReader(s)) fun next(): String { while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) return st.nextToken() } fun nextInt() = next().toInt() fun nextLong() = next().toLong() fun nextLine() = br.readLine() fun nextDouble() = next().toDouble() fun ready() = br.ready() }