하나의 리스트에서 모든 조합을 구할 때 combinations를 쓰면 편하다.
from itertools import combinations
L, C = map(int, input().split())
chars = sorted(list(input().split()))
vowels = set(['a', 'e', 'i', 'o', 'u'])
for password in list(combinations(chars, L)): # L길이로 가능한 모든 비번 조합 에서 하나씩
v_cnt = c_cnt = 0
for ps in password:
if ps in vowels: # 모음 개수 세기
v_cnt += 1
else:
c_cnt += 1 # 자음 개수 세기
if v_cnt >= 1 and c_cnt >= 2:
print("".join(password))