S = input().strip() T = input().strip() if len(T) == 1: if T in S: print(-1) else: print(0) else: len_T = len(T) occurrences = [] for i in range(len(S) - len_T + 1): if S[i:i+len_T] == T: occurrences.append(i) if not occurrences: print(0) else: intervals = [] for s in occurrences: end = s + len_T - 2 intervals.append((s, end)) intervals.sort(key=lambda x: x[1]) count = 0 last_end = -1 for start, end in intervals: if start > last_end: count += 1 last_end = end print(count)