S = input() T = input() if len(T)==1: print(-1) exit() i = 0 j = 0 cnt = 0 while i