import java.util.*;
import java.io.BufferedInputStream;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedInputStream(System.in));
String a = sc.nextLine();
String sen = sc.nextLine();
String e [] = sen.split(" ");
int y = 0;
for(int t = 0;t < e.length;t++) {
boolean c = a.equalsIgnoreCase(e[t]);
if(c == true) {
y++;
}
}
if(y != 0) {
System.out.print(y + " ");
}
for(int p = 0;p < e.length;p++) {
boolean c = a.equalsIgnoreCase(e[p]);
if(c == true) {
System.out.print(p);
break;
}
}
if(y == 0) {
System.out.println("-1");
}
}
}