You are given a string $t$ consisting of $n$ lowercase Latin letters and an integer number $k$.

Let's define a substring of some string $s$ with indices from $l$ to $r$ as $s[l \dots r]$.

Your task is to construct such string $s$ of minimum possible length that there are exactly $k$ positions $i$ such that $s[i \dots i + n - 1] = t$. In other words, your task is to construct such string $s$ of minimum possible length that there are exactly $k$ substrings of $s$ equal to $t$.

It is guaranteed that the answer is always unique.


-----Input-----

The first line of the input contains two integers $n$ and $k$ ($1 \le n, k \le 50$) — the length of the string $t$ and the number of substrings.

The second line of the input contains the string $t$ consisting of exactly $n$ lowercase Latin letters.


-----Output-----

Print such string $s$ of minimum possible length that there are exactly $k$ substrings of $s$ equal to $t$.

It is guaranteed that the answer is always unique.


-----Examples-----
Input
3 4
aba

Output
ababababa

Input
3 2
cat

Output
catcat

Difficulty: introductory

Starter code:

Solutions:
'''input
3 4
aba
'''
n, k = map(int, input().split())
t = input()
for i in range(1, n):
	if t[i:] == t[:n-i]:
		print(t[:i] * k + t[i:])
		break
else:
	print(t * k)

n, k = map(int, input().split())
t = input()

double = 0
for i in range(1, n):
	if t[-i:] == t[:i]:
		double = i

print(t + t[double:] * (k - 1))

n, k = list(map(int,input().split()))
s = input()
i = 1
while i < len(s) and s[i:] != s[:n-i]:
    i += 1
t = s[:i]*k + s[i:]
print(t)


n, k = map(int, input().split())
s = input()
p = [0] * len(s)

for i in range(1, len(s)):
    p[i] = p[i - 1]
    while p[i] > 0 and s[p[i]] != s[i]:
        p[i] = p[p[i] - 1]
    if s[p[i]] == s[i]:
        p[i] += 1

print(s, end = '')
for i in range(1, k):
    for j in range(p[-1], len(s)):
        print(s[j], end='')
print()


n, k = map(int, input().split())
s = input()
max_pref = 0

for i in range(1, n):
  if s[:i] == s[-i:]:
    max_pref = i

ans = s
for i in range(k - 1):
  ans += s[max_pref:]

print(ans)

n, k = list(map(int, input().split()))
t = input()

a = -1
for i in range(1, n + 1):
    if t.startswith(t[i:]):
        a = i
        break

pre = t[:a]
ans = pre * (k - 1) + t

print(ans)


n, k = list(map(int, input().strip().split()))
st = [i for i in input()]

p = n
for i in range(1, n):
    if st[i:] == st[:n - i]:
        p = i
        break

print(''.join(st) + (''.join(st[n - p:])) * (k - 1))


n,m=list(map(int,input().split()))
s=input()
x=0
for i in range(1,n):
    if s[i::]==s[0:n-i]:
        x=n-i
        break
ans=s+s[x::]*(m-1)
print(ans)




inp1 = input().split()
n = int(inp1[0])
k = int(inp1[1])

s = input()

def isGood(l):
    if(l==0):
        return True
    s1 = s[0:l]
    s2 = s[n-l:n]
    return s1==s2

maxMatch = 0

for i in range(n-1,0,-1):
    if isGood(i):
        maxMatch = i
        break

ans = ""
for i in range(k):
    if(i==0):
        ans+=s
    else:
        ans+=s[maxMatch:n]

print(ans)


s=input().split()
n=int(s[0])
k=int(s[1])
s=input()
if n==1:
    print(s*k)
elif k==1:
    print(s)
else:
    flag=True
    for i in range(1,n):
        if s[:-i]==s[i:]:
            print(s+s[-i:]*(k-1))
            flag=False
            break
    if flag:
        print(s*k)


n,k=map(int,input().split())
t=input()
for i in range(n-1):
    if t[i+1:n]==t[0:n-i-1]:
        print(t+(k-1)*t[n-i-1:n])
        break
else:
    print(k*t)

n, k = list(map(int, input().split()))
t = input()
a = 0
for i in range(1, n):
    if t[i:] == t[:-i]:
        a = i
        break

if not a:
    print(t * k)
else:
    print(t + t[n-a:]*(k-1))


n,k=list(map(int,input().split()))
t=input()

for i in range(n-1,-1,-1):
    if t[:i]==t[n-i:]:
        #print(t[:i],t[n-i:])
        break


x=t[i:]

for j in range(k-1):
    t=t+x

#print(i)
print(t)


n, k = list(map(int,input().split()))
s = input()

res = n
for i in range(1, n):
    if s.startswith(s[i:]):
        res = i
        break
overlap = n - res

print(s + (k-1) * s[overlap:])

n, k = list(map(int, input().split()))
t = list(input())
for i in range(1, n + 1):
    if t[i:] == t[:n - i]:
        s = t[:i] * k
        s += t[i:]
        break
print(''.join(s))



n, k = list(map(int, input().split()))
string = input()

res = None
for i in range(1, n):
    if string.startswith(string[i:]):
        res = string[:i] * k + string[i:]
        break

if not res:
    print(string * k)
else:
    print(res)



n, k = map(int, input().split())
t = input()
P = [0] * n
for i in range(1, n):
    j = P[i - 1]
    while t[j] != t[i] and j > 0:
        j = P[j - 1]
    if t[i] == t[j]:
        j += 1
    P[i] = j

ans = t[:(n - P[n - 1])] * k
if P[n - 1] > 0:
    ans += t[(n - P[n - 1]):]
print(ans)

n,m=map(int,input().strip().split())
r=input()
ans=""
ans1=""
for i in range(n-1):
    if r[:i+1]==r[n-1-i:]:
        ans=r[:i+1]
j=len(ans)
ans1=r+(m-1)*r[j:]
print(ans1)

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

n,k = inpl()
S = input()

for i in reversed(list(range(n))):
	if S[:i] == S[n-i:]:
		break

ans = S
for _ in range(k-1):
	ans += S[i:]

print(ans)


3

n, k = [int(x) for x in input().split()]

t = input()
max_prefix = ''

for i in range(1, len(t)):
    l = t[-i:]
    # print(str(i) + " : " + l)
    if(t.startswith(l)):
        max_prefix = l

# print("Max prefix :- " + max_prefix)

s = ''

if len(max_prefix) == 0:
    for i in range(k):
        s = s + t
else:
    p = t[:n-len(max_prefix)]
    for i in range(k-1):
        s = s + p
    s = s + t

print(s)


n, k = map(int, input().split())
s = input()
x = n
for i in range(1, n):

    if s[:n - i] == s[i:]:
        x = i
        break
ans = s
for i in range(k - 1):
    ans += s[n - x:]
print(ans)


N, K = list(map(int, input().split()))
T = input()

def findAns(N, T):
    for i in range(N-1):
        if T[i+1:] == T[:N-1-i]:
            return T[N-1-i:]
    return T

ans = findAns(N, T)

print(T + ans*(K-1))
    


n, k = map(int, input().split())
t = input()
cycle = n
for i in range(1, n):
    if t[i:] == t[:n - i]:
        cycle = i
        break
ans = t[:cycle] * k + t[cycle:]
print(ans)

def counter(s, t): ## O(n**2) potentially oops

    how_many = 0

    for i in range(0, len(s)-len(t)+1):

        ## print(i, i+len(t))

        if s[i:i+len(t)] == t:
            how_many += 1

    return how_many

while True:
    
    inp = input().split()

    n = int(inp[0])
    k = int(inp[1])

    s = input()

    returning = s

    for i in range(1, n+1):
        if counter(returning+s[-i:], s) > counter(returning, s): ## (returning + s[-i:]).count(s) > returning.count(s):
            addition = s[-i:]
            break

    returning = s + (k-1)*addition

##    while counter(returning, s) < k: ## returning.count(s) < n:
##
##        for i in range(1, n+1):
##
##            if counter(returning+s[-i:], s) > counter(returning, s): ## (returning + s[-i:]).count(s) > returning.count(s):
##
##                returning += s[-i:]
##                break

    print(returning)

    break


n, k = map(int, input().split())
t = input()
i = n - 1
while i > 0 and t[:i] != t[-i:]:
    i -= 1
ans = t
for g in range(k - 1):
    ans += t[-n+i:]
print(ans)