Little penguin Polo adores strings. But most of all he adores strings of length n.

One day he wanted to find a string that meets the following conditions:  The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct.  No two neighbouring letters of a string coincide; that is, if we represent a string as s = s_1s_2... s_{n}, then the following inequality holds, s_{i} ≠ s_{i} + 1(1 ≤ i < n).  Among all strings that meet points 1 and 2, the required string is lexicographically smallest. 

Help him find such string or state that such string doesn't exist.

String x = x_1x_2... x_{p} is lexicographically less than string y = y_1y_2... y_{q}, if either p < q and x_1 = y_1, x_2 = y_2, ... , x_{p} = y_{p}, or there is such number r (r < p, r < q), that x_1 = y_1, x_2 = y_2, ... , x_{r} = y_{r} and x_{r} + 1 < y_{r} + 1. The characters of the strings are compared by their ASCII codes.


-----Input-----

A single line contains two positive integers n and k (1 ≤ n ≤ 10^6, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters.


-----Output-----

In a single line print the required string. If there isn't such string, print "-1" (without the quotes).


-----Examples-----
Input
7 4

Output
ababacd

Input
4 7

Output
-1

Difficulty: EASY
Tags: Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
(n, m) = list(map(int, input().split()))
if m > n or (m == 1 and n > 1):
	print(-1)
	return
if m == 1:
	print('a')
	return
l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
s = ''
for i in range(2, m):
	s += l[i]
n -= m - 2
l = ''
l += 'ab' * int(n / 2)
if n % 2 != 0:
	l += 'a'
print(l + s)


(n, k) = map(int, input().split())
ascii = 'abcdefghijklmnopqrstuvwxyz'
if k > n:
	print(-1)
elif n == 1 and k == 1:
	print('a')
elif n != 1 and k == 1:
	print(-1)
else:
	t1 = k - 2
	t2 = n - t1
	tam = t2 // 2
	kal = t2 % 2
	r = 'ab' * tam + 'a' * kal
	for i in range(t1):
		i += 2
		r += ascii[i]
	print(r)


from string import ascii_lowercase
(n, k) = [int(x) for x in input().split()]
if n == 1 and k == 1:
	print('a')
	exit(0)
if n < k or k == 1:
	print(-1)
	exit(0)
print('ab' * ((n - k + 2) // 2) + ('a' if (n + k) % 2 == 1 else '') + ascii_lowercase[2:k])


a = 'abcdefghijklmnopqrstuvwxyz'
(n, k) = map(int, input().split())
t = a[:2] * n
if k > n or (k == 1 and n != 1):
	print(-1)
elif n == 1:
	print('a')
else:
	print(t[:n - k + 2] + a[2:k])


(n, k) = map(int, input().split())
if k > n or (n > 1 and k <= 1):
	print(-1)
	exit()
s = 'a'
if n > 1:
	b = 1
else:
	b = 0
a = (n - k + 1) // 2
b += (n - k) // 2
while a > 0 or b > 0:
	if s[-1] == 'a':
		s += 'b'
		b -= 1
	else:
		s += 'a'
		a -= 1
i = len(s)
l = 99
while i < n:
	s += chr(l)
	l += 1
	i += 1
print(s)


import string
import sys
(n, k) = list(map(int, input().split()))
if k > n or k > 26:
	print(-1)
	return
if k == 1 and n > 1:
	print(-1)
	return
if k == 1 and n == 1:
	print('a')
	return
if k % 2 == 0 and n % 2 == 1:
	rightnum = k - 2
	leftnum = n - rightnum
	leftnum //= 2
	left = 'ab' * leftnum
	left += 'a'
	right = string.ascii_lowercase[2:2 + rightnum]
	print(left + right)
	return
if k % 2 == 0 and n % 2 == 0:
	rightnum = k - 2
	leftnum = n - rightnum
	leftnum //= 2
	left = 'ab' * leftnum
	right = string.ascii_lowercase[2:2 + rightnum]
	print(left + right)
	return
if k % 2 == 1 and n % 2 == 0:
	rightnum = k - 2
	leftnum = n - rightnum
	leftnum //= 2
	left = 'ab' * leftnum
	left += 'a'
	right = string.ascii_lowercase[2:2 + rightnum]
	print(left + right)
	return
if k % 2 == 1 and n % 2 == 1:
	rightnum = k - 2
	leftnum = n - rightnum
	leftnum //= 2
	left = 'ab' * leftnum
	right = string.ascii_lowercase[2:2 + rightnum]
	print(left + right)
	return


a = list(map(int, input().split()))
if (a[0] > 1) & (a[1] == 1):
	print(-1)
elif a[0] == a[1] == 1:
	print('a')
elif a[1] > a[0]:
	print(-1)
else:
	print('ab' * ((a[0] + 2 - a[1]) // 2) + 'a' * ((a[0] - a[1]) % 2) + ''.join(map(lambda x: chr(ord('c') + x), range(a[1] - 2))))


from sys import stdin, stdout

def main(n, k):
	if k > n or (k == 1 and n > 1):
		stdout.write('-1\n')
		return
	i = 0
	while i < n - k + 2:
		stdout.write('a')
		i += 1
		if i < n - k + 2 and i < n:
			stdout.write('b')
		i += 1
	for i in range(k - 2):
		stdout.write(chr(ord('c') + i))
	stdout.write('\n')
(n, k) = map(int, stdin.readline().strip().split(' '))
main(n, k)


import sys
import math
(n, k) = [int(x) for x in sys.stdin.readline().split()]
if k == 1 and n == 1:
	print('a')
	exit()
if k == 1 or k > n:
	print(-1)
	exit()
res = ['a', 'b'] * int(n / 2)
if n % 2 != 0:
	res.append('a')
t = 2
for i in range(n - (k - 2), n):
	res[i] = chr(t + 97)
	t += 1
print(''.join(res))


(n, k) = map(int, input().split())
ans = ''
if n < k or (k == 1 and n > 1):
	print(-1)
elif n == 1 and k == 1:
	print('a')
else:
	cnt = 0
	for i in range(n - (k - 2)):
		if cnt % 2 == 0:
			print('a', end='')
		else:
			print('b', end='')
		cnt += 1
	alphabet_list = 'cdefghijklmnopqrstuvwxyz'
	for i in range(k - 2):
		print(alphabet_list[i], end='')


(n, k) = map(int, input().split())
if n == 1 and k == 1:
	print('a')
elif n < k or k < 2:
	print(-1)
else:
	L = [chr(ord('a') + 2 + i) for i in range(k - 2)]
	end = ''.join(L)
	s = 'ab' * ((n - k + 2) // 2)
	if (n - k) % 2 == 0:
		print(s + end)
	else:
		print(s + 'a' + end)


(n, k) = map(int, input().split())
if n < k or k > 26:
	print(-1)
elif k == 1:
	print('a' if n == 1 else -1)
else:
	print(('ab' * (n // 2 + 1))[:n - k + 2] + 'cdefghijklmnopqrstuvwxyz'[:k - 2])


(n, k) = map(int, input().split())
if n < k:
	print(-1)
	return
if n == k:
	ans = [chr(i + 97) for i in range(k)]
	print(''.join(ans))
	return
if k == 1:
	print(-1)
	return
if k == 2:
	ans = 'ab' * (n // 2) + 'ab'[:n % 2]
	print(ans)
	return
rem = k - 2
ans = 'ab' * (n // 2) + 'ab'[:n % 2]
ans = list(ans)
c = 99
for i in range(n - rem, n):
	ans[i] = chr(c)
	c += 1
print(''.join(ans))


import sys
(n, k) = map(int, sys.stdin.readline().split())
if k > n or (k == 1 and n != 1):
	print(-1)
else:
	l = [' ' for i in range(n)]
	last = ord('a') + k - 1
	m = n - 1
	for i in range(k - 2):
		l[m] = chr(last - i)
		m -= 1
	start = ord('a')
	for i in range(n):
		if l[i] != ' ':
			break
		else:
			l[i] = chr(start)
			if i % 2 == 1:
				start -= 1
			else:
				start += 1
	print(''.join(l))


import string
rd = lambda : list(map(int, input().split()))
(n, k) = rd()
if k > 26 or k > n or (k == 1 and n > 1):
	print(-1)
elif k == 1 and n == 1:
	print('a')
else:
	print(('ab' * (n + 1 >> 1))[:n - k + 2] + string.ascii_lowercase[2:k])


X = list(map(int, input().split()))
Temp = ''.join([chr(ord('a') + i) for i in range(X[1])])
if X[1] == 1 and X[0] == 1:
	print('a')
elif X[1] > X[0] or X[1] == 1:
	print(-1)
else:
	print('ab' * ((X[0] - X[1] + 2) // 2) + 'a' * ((X[0] - X[1] + 2) % 2) + Temp[2:])


s = 'cdefghijklmnopqrstuvwxyz'
(n, k) = map(int, input().split())
if n < k:
	print(-1)
elif k == 1:
	if n == k:
		print('a')
	else:
		print(-1)
elif k == 2:
	print('ab' * (n // 2) + 'a' * (n % 2))
else:
	ab = n - k + 2
	ss = 'ab' * (ab // 2) + 'a' * (ab % 2) + s[:k - 2]
	print(ss)


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n, k) = I()
c = [chr(i + 97) for i in range(k)]
if n < k or (k == 1 and n > 1):
	print(-1)
	exit()
if n == 1:
	print(c[0])
	exit()
m = n - k + 2
ans = 'ab' * (m // 2) + 'a' * (m % 2)
print(ans + ''.join(c[2:]))


(n, k) = map(int, input().split())
if k == 1 and n != 1 or k > n:
	print(-1)
elif n == 1:
	print('a')
else:
	s1 = []
	s2 = []
	for i in range(k - 1, 1, -1):
		c = chr(97 + i)
		s1.append(c)
		s2.append(c)
	for i in range(n - k + 2):
		if i % 2 == 0:
			s1.append('a')
			s2.append('b')
		else:
			s1.append('b')
			s2.append('a')
	s1 = s1[::-1]
	s2 = s2[::-1]
	s1 = ''.join(s1)
	s2 = ''.join(s2)
	print(min(s1, s2))


def polo(n, k):
	if k == 1 and n > 1:
		return -1
	if k == 1 and n == 1:
		return 'a'
	if k > n:
		return -1
	base = 'ab' * n
	k -= 2
	n -= k
	ans = base[:n]
	l = 'cdefghijklmnopqrstuvwxyz'
	ans += l[:k]
	return ans
(a, b) = map(int, input().strip().split())
print(polo(a, b))


(n, k) = [int(x) for x in input().split()]
if n < k or (k == 1 and n >= 2):
	print(-1)
	return
if k == 1:
	print('a')
	return
st = ''
flag = 1
for i in range(n - k + 2):
	if flag:
		st += 'a'
		flag = 0
	else:
		st += 'b'
		flag = 1
num = ord('c')
for i in range(0, k - 2):
	st += chr(num + i)
print(st)


import collections
import functools
import math
import sys
import bisect

def In():
	return map(int, sys.stdin.readline().split())
input = sys.stdin.readline

def pologen():
	(n, k) = In()
	if n < k or (k == 1 and n > 1):
		return -1
	ans = []
	for i in range(n - k + min(2, k)):
		ans.append(chr(97 + i % 2))
	for i in range(2, k):
		ans.append(chr(97 + i))
	return ''.join(ans)
print(pologen())


(n, k) = map(int, input().split())
if n < k:
	print('-1')
elif n == k:
	l = ''
	m = ord('a')
	while k:
		l += chr(m)
		m += 1
		k -= 1
	print(l)
else:
	if k == 1:
		print('-1')
		exit(0)
	l = ''
	p = k - 2
	o = n - p
	while o:
		l += 'a'
		o -= 1
		if o == 0:
			break
		l += 'b'
		o -= 1
	m = ord('c')
	while p:
		l += chr(m)
		m += 1
		p -= 1
	print(l)


(n, k) = map(int, input().split())
if k > n or (k == 1 and n > 1):
	print(-1)
	exit()
if n == 1:
	print('a')
else:
	d = n - k + 2
	ans = 'ab' * (d // 2) + 'a' * (d % 2)
	ind = 2
	for i in range(d, n):
		ans += chr(ord('a') + ind)
		ind += 1
	print(ans)


import bisect
from itertools import accumulate
import os
import sys
import math
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
if k > n:
	print(-1)
elif n == 1 and k == 1:
	print('a')
elif k == 1:
	print(-1)
else:
	ans = ''
	k = k - 2
	n = n - k
	z = 99
	if n % 2 == 0:
		ans += 'ab' * (n // 2)
		while k > 0:
			ans += chr(z)
			z += 1
			k -= 1
	else:
		x = 99
		ans += 'ab' * (n // 2)
		ans += 'a'
		while k > 0:
			ans += chr(x)
			x += 1
			k -= 1
	print(ans)


(n, k) = map(int, input().split())
alp = 'abcdefghijklmnopqrstuvwxyz'
if k > n or (k == 1 and n != 1):
	print(-1)
	exit()
if n == 1:
	print('a')
	exit()
s = ''
for i in range(n - (k - 2)):
	if i % 2 == 0:
		s += 'a'
	else:
		s += 'b'
s += alp[2:k]
print(s)


letter = [chr(ord('a') + i) for i in range(26)]
(n, k) = [int(i) for i in input().split()]
if k > n or (k == 1 and n > 1):
	print(-1)
	exit()
if k == 1:
	print('a')
	exit()
ans = [letter[i % 2] for i in range(n - k + 2)]
ans += [letter[2 + i] for i in range(k - 2)]
print(''.join(ans))


(n, k) = map(int, input().split())
if n == 1 and k == 1:
	print('a')
elif k > n or k == 1:
	print(-1)
elif k == 2:
	s = ''
	if n % 2 == 0:
		s = ['a', 'b'] * (n // 2)
	else:
		s = ['a', 'b'] * (n // 2)
		s.append('a')
	ans = ''.join(s)
	print(ans)
elif k == n:
	s = ''
	for i in range(n):
		s = s + chr(i + 97)
	print(s)
else:
	s = []
	k = k - 2
	rem = n - k
	if rem % 2 == 0:
		s = ['a', 'b'] * (rem // 2)
	else:
		s = ['a', 'b'] * (rem // 2)
		s.append('a')
	j = 0
	for i in range(n - k, n):
		s.append(chr(j + 99))
		j += 1
	ans = ''.join(s)
	print(ans)


(n, k) = map(int, input().split())
if k > n:
	print(-1)
elif n == k:
	for i in range(0, n):
		print(chr(i + 97), end='')
	print('')
elif n == 1 and k == 1:
	print('a')
elif n != 1 and k == 1:
	print(-1)
else:
	r = n - k
	s = 'ab'
	s += 'ab' * (r // 2)
	s += 'a' * (r % 2)
	c = 99
	for i in range(len(s), n):
		s += chr(c)
		c += 1
	print(s)


(n, k) = map(int, input().split())
if k > n or (k == 1 and n > 1):
	print('-1')
	exit()
if k == 1 and n == 1:
	print('a')
	exit()
y = n - k
str = 'ab' * (y // 2)
if y % 2 == 1:
	str += 'a'
str = 'ab' + str
k -= 2
i = 99
while k > 0:
	str += chr(i)
	k -= 1
	i += 1
print(str)


import math
(n, k) = map(int, input().strip().split(' '))
s = 'abcdefghijklmnopqrstuvwxyz'
if k > n:
	print(-1)
elif k == 1 and n != 1:
	print(-1)
elif k == n:
	print(s[:k])
else:
	p = n - k
	s1 = 'ab' * (p // 2 + 1)
	print('ab' + s1[:p] + s[2:k])


import sys
(n, k) = map(int, sys.stdin.readline().split())
if k == 1 and n != 1 or k > n:
	print(-1)
elif n == 1:
	print('a')
else:
	tmp = n - k + 2
	s = 'ab' * (tmp // 2)
	if tmp % 2 == 1:
		s += 'a'
	for i in range(2, k):
		s += chr(ord('a') + i)
	print(s)


(n, k) = map(int, input().split())
from sys import exit
if k == 1:
	if n == 1:
		print('a')
	else:
		print(-1)
	exit()
if k > n:
	print(-1)
	exit()
alfa = 'cdefghijklmnopqrstuvwxyz'
res = 'ab' * ((n - k + 2) // 2)
if (n - k + 2) % 2 == 1:
	res += 'a'
res += alfa[:k - 2]
print(res)


alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
string = input()
numbers = string.split()
(a, b) = (int(numbers[0]), int(numbers[1]))
condition = a > 1 and b == 1
if b > a or condition:
	print(-1)
else:
	if a == 1:
		s = 'a'
	else:
		n = a - b + 2
		s = 'ab' * (n // 2)
		if n % 2 == 1:
			s += 'a'
		for x in range(2, b):
			s += alphabet[x]
	print(s)


(n, k) = list(map(int, input().split()))
if k > n:
	print(-1)
elif k == 1 and n == 1:
	print('a')
elif k == 1:
	print(-1)
elif k == 2:
	print(('ab' * n)[:n])
else:
	al = sorted('qwertyuiopasdfghjklzxcvbnm')
	k -= 2
	tail = ''.join(al[2:2 + k])
	left = n - k
	head = ('ab' * left)[:left]
	s = head + tail
	print(s)


def main():
	(n, k) = map(int, input().split())
	if n < k or k == 1 < n:
		print(-1)
	elif n - k & 1:
		print('ab' * ((n - k + 1) // 2) + 'acdefghijklmnopqrstuvwxyz'[:k - 1])
	else:
		print('ab' * ((n - k) // 2) + 'abcdefghijklmnopqrstuvwxyz'[:k])
main()


(n, k) = map(int, input().split())
if k > n:
	print(-1)
elif n == 1 and k == 1:
	print('a')
elif k == 1:
	print(-1)
else:
	ans = ''
	k = k - 2
	n = n - k
	z = 99
	if n % 2 == 0:
		ans += 'ab' * (n // 2)
		while k > 0:
			ans += chr(z)
			z += 1
			k -= 1
	else:
		x = 99
		ans += 'ab' * (n // 2)
		ans += 'a'
		while k > 0:
			ans += chr(x)
			x += 1
			k -= 1
	print(ans)


(n, k) = map(int, input().split())
if n == 1 and k == 1:
	print('a')
elif n > 1 and k < 2 or k > n:
	print(-1)
else:
	s = ''
	for i in range(n - k + 2):
		if i % 2 == 0:
			s += 'a'
		else:
			s += 'b'
	c = 99
	for i in range(k - 2):
		s += chr(c)
		c += 1
	print(s)


(a, b) = map(int, input().split())
if b == 1 and a != 1:
	print(-1)
elif a < b:
	print(-1)
elif a == 1 == b:
	print('a')
else:
	b -= 2
	a -= b
	print('ab' * (a // 2) + 'a' * (a % 2), end='')
	for i in range(b):
		print(chr(99 + i), end='')


import os
from math import *
(n, k) = map(int, input().split())
x = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
if n < k:
	print('-1')
elif n >= k and n != 1 and (k == 1):
	print('-1')
elif n == 1 and k == 1:
	print('a')
else:
	k -= 2
	n -= k
	for i in range(n):
		print(x[i % 2], end='')
	for j in range(k):
		print(x[j + 2], end='')


import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def revn(n):
	m = 0
	while n > 0:
		m = m * 10 + n % 10
		n = n // 10
	return m
(n, k) = mi()
sample = 'abcdefghijklmnopqrstuvwxyz'
if n == k:
	print(sample[:k])
elif n < k or (n > 1 and k == 1):
	print(-1)
else:
	print('ab' * ((n - k + 2) // 2) + 'a' * ((n - k) % 2) + sample[2:k])


(n, k) = list(map(int, input().split()))
if k > n:
	print(-1)
	exit()
if k == 1 and n > 1:
	print(-1)
	exit()
if k == 1 and n == 1:
	print('a')
	exit()
s = ''
f = 1
for i in range(n + 2 - k):
	s += 'a' if f else 'b'
	f = 1 - f
c = ord('c')
for i in range(n + 2 - k, n):
	s += chr(c)
	c += 1
print(s)


(n, k) = input().split()
n = int(n)
k = int(k)
if k > n:
	print('-1')
elif k == 1 and n > 1:
	print('-1')
elif k == 1 and n == 1:
	print('a')
else:
	v = k - 2
	n1 = n - v
	x = int(n1 / 2)
	st = ''
	for i in range(x):
		st = st + 'ab'
	if n1 % 2 != 0:
		st = st + 'a'
	asc = 99
	for i in range(0, v):
		st = st + chr(asc)
		asc = asc + 1
	print(st)


(n, k) = map(int, input().split())
if k > n:
	print(-1)
elif k == 1:
	if n == 1:
		print('a')
	else:
		print(-1)
else:
	alph = ''
	for i in range(26):
		alph += chr(i + 97)
	ans = alph[:k]
	n -= k
	if n % 2:
		z = ans[0] + ans[1] + 'ab' * (n // 2) + 'a' + ans[2:]
	else:
		z = ans[0] + ans[1] + 'ab' * (n // 2) + ans[2:]
	print(z)


(n, k) = map(int, input().split())
if k > n or (k == 1 and n != 1):
	print(-1)
else:
	s = ('ab' * (n // 2 + 1))[:n]
	print(s[:-(k - 2)] + ''.join([chr(97 + i) for i in range(2, k)]) if k > 2 else s)


def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def msi():
	return map(str, input().split())

def li():
	return list(mi())
(n, k) = mi()
if n == 1 and k == 1:
	print('a')
elif k == 1 and n > 1:
	print(-1)
elif k > n:
	print(-1)
else:
	res = n - k + 2
	te = ''
	for i in range(k - 2):
		te += chr(99 + i)
	st = 'ab' * (res // 2) + 'a' * (res % 2) + te
	print(st)


def pinguin(n, k):
	if n == k == 1:
		return 'a'
	if n < k or k == 1:
		return -1
	s1 = 'ab' * ((n - k) // 2 + 1)
	if (n + k) % 2 == 1:
		s2 = 'a'
	else:
		s2 = ''
	s3 = ''
	for i in range(2, k):
		s3 += chr(i + ord('a'))
	return s1 + s2 + s3
(N, K) = [int(j) for j in input().split()]
print(pinguin(N, K))


(n, k) = [int(x) for x in input().split()]
if k > n or (k == 1 and n > 1):
	print(-1)
elif k == 1 and n == 1:
	print('a')
else:
	first_char = 97
	letters = [chr(x) for x in range(first_char, first_char + k)]
	word = ('ab' * (n + 1 // 1))[:n - k + 2]
	word += ''.join(letters[2:k])
	print(word)


(n, t) = map(int, input().split())
alphas = 'abcdefghijklmnopqrstuvwxyz'
if t > n:
	print(-1)
elif n > 1 and t == 1:
	print(-1)
elif n == 1 and t == 1:
	print('a')
elif t == n:
	print(alphas[:n])
else:
	ans = ''
	if (n - (t - 2)) % 2 == 1:
		ans += 'ab' * ((n - (t - 2)) // 2)
		ans += 'a'
		if t > 2:
			ans += alphas[2:t - 2 + 2]
	else:
		ans += 'ab' * ((n - (t - 2)) // 2)
		if t > 2:
			ans += alphas[2:t - 2 + 2]
	print(ans)


(a, b) = map(int, input().split())
s = 'cdefghijklmnopqrstuvwxyz'
if b > a or (b == 1 and a != 1):
	print(-1)
else:
	if a == 1 and b == 1:
		print('a')
		exit()
	if (a - b) % 2 != 0:
		q = 'ab' * ((a - b + 2) // 2)
		q = q + 'a'
		for g in range(b - 2):
			q = q + s[g]
	else:
		q = 'ab' * ((a - b + 2) // 2)
		for g in range(b - 2):
			q = q + s[g]
	print(q)


(a, b) = [int(i) for i in input().split()]
if b > a:
	print(-1)
elif b == 1:
	if a > 1:
		print(-1)
	else:
		print('a')
else:
	b -= 2
	for i in range(0, a - b):
		if i % 2 == 0:
			print('a', end='')
		else:
			print('b', end='')
	for i in range(b):
		print(chr(ord('c') + i), end='')


li = list(map(int, input().split()))
n = li[0]
k = li[1]
s = ''
if k > n or (k < 2 and n != 1) or k == 0:
	print(-1)
else:
	if n - k == 0:
		for i in range(97, 97 + k):
			s += chr(i)
	else:
		for i in range(n - (k - 2)):
			if i % 2 == 0:
				s += chr(97)
			else:
				s += chr(98)
	if n != k:
		for i in range(99, 99 + (k - 2)):
			s += chr(i)
print(s)