#include<iostream>
#include<cstring>
using namespace std;
int Findstr(char s1[] , char s2[]) {
int len1 = strlen(s1);
int len2 = strlen(s2);
if(len2 == 0) return 0; //空串返回0
int i = 0;
int j = 0;
while(s1[i]!='\0' && s2[j]!='\0') {
if(s1[i] == s2[j]) {
i++;
j++;
}
else
{
i = i-j+2;
j = 0;
}
}
if(s2[j]=='\0') return i-len2+1;
else return -1;
}
int main() {
char s1[100];
char s2[10];
cin >> s1 ;
cin >> s2 ;
cout << Findstr(s1,s2);
return 0;
}