Vanya is managed to enter his favourite site Codehorses. Vanya uses n distinct passwords for sites at all, however he can't remember which one exactly he specified during Codehorses registration.

Vanya will enter passwords in order of non-decreasing their lengths, and he will enter passwords of same length in arbitrary order. Just when Vanya will have entered the correct password, he is immediately authorized on the site. Vanya will not enter any password twice.

Entering any passwords takes one second for Vanya. But if Vanya will enter wrong password k times, then he is able to make the next try only 5 seconds after that. Vanya makes each try immediately, that is, at each moment when Vanya is able to enter password, he is doing that.

Determine how many seconds will Vanya need to enter Codehorses in the best case for him (if he spends minimum possible number of second) and in the worst case (if he spends maximum possible amount of seconds).


-----Input-----

The first line of the input contains two integers n and k (1 ≤ n, k ≤ 100) — the number of Vanya's passwords and the number of failed tries, after which the access to the site is blocked for 5 seconds.

The next n lines contains passwords, one per line — pairwise distinct non-empty strings consisting of latin letters and digits. Each password length does not exceed 100 characters.

The last line of the input contains the Vanya's Codehorses password. It is guaranteed that the Vanya's Codehorses password is equal to some of his n passwords.


-----Output-----

Print two integers — time (in seconds), Vanya needs to be authorized to Codehorses in the best case for him and in the worst case respectively.


-----Examples-----
Input
5 2
cba
abc
bb1
abC
ABC
abc

Output
1 15

Input
4 100
11
22
1
2
22

Output
3 4



-----Note-----

Consider the first sample case. As soon as all passwords have the same length, Vanya can enter the right password at the first try as well as at the last try. If he enters it at the first try, he spends exactly 1 second. Thus in the best case the answer is 1. If, at the other hand, he enters it at the last try, he enters another 4 passwords before. He spends 2 seconds to enter first 2 passwords, then he waits 5 seconds as soon as he made 2 wrong tries. Then he spends 2 more seconds to enter 2 wrong passwords, again waits 5 seconds and, finally, enters the correct password spending 1 more second. In summary in the worst case he is able to be authorized in 15 seconds.

Consider the second sample case. There is no way of entering passwords and get the access to the site blocked. As soon as the required password has length of 2, Vanya enters all passwords of length 1 anyway, spending 2 seconds for that. Then, in the best case, he immediately enters the correct password and the answer for the best case is 3, but in the worst case he enters wrong password of length 2 and only then the right one, spending 4 seconds at all.

Difficulty: interview

Starter code:

Solutions:
n, k = list(map(int, input().split()))
a = []
for i in range(n):
    a.append(input())
s = input()
kmn = 1
kmx = 0
for i in range(n):
    if (len(a[i]) < len(s)):
        kmn += 1
        kmx += 1
    elif (len(a[i]) == len(s)):
        kmx += 1
print((kmn - 1) // k * 5 + kmn, (kmx - 1) // k * 5 + kmx)


#!/usr/bin/env python3


def main():
    try:
        while True:
            n, k = list(map(int, input().split()))
            ls = sorted((input() for i in range(n)), key=len)
            true = len(input())
            first = 1e9
            last = 0
            cur = 0
            flag = True
            for i, s in enumerate(ls):
                cur += 1
                if len(s) == true:
                    last = cur
                    if flag:
                        flag = False
                        first = cur
                elif not flag:
                    break
                if (i + 1) % k == 0:
                    cur += 5

            print(first, last)

    except EOFError:
        pass


main()


from collections import Counter

def f(x, k):
    return 5*((x-1)//k) + x

n, k = [int(s) for s in input().split()]
ctr = Counter()
for i in range(n):
    ctr[len(input())] += 1

lc = len(input())

x = sum(ctr[l] for l in ctr if l < lc) + 1
y = sum(ctr[l] for l in ctr if l <= lc)

print(f(x,k), f(y,k))


#def hh(a):
#    return -a

import sys, math
n, k = list(map(int, input().split()))
z = [0] * n
for i in range(n):
    z[i] = len(input())
#z.sort(key = hh)
passw = len(input())
bef = 0
same = 0
for i in range(n):
    if z[i] == passw:
        same += 1
    elif z[i] < passw:
        bef += 1
print((bef + 1) + 5 * (bef // k), (bef + same) + 5 * ((bef + same - 1) // k))


def count_time(_key):
    i = sorted(variants, key=_key).index(password)
    return i + 1 + i // k * 5


n, k = list(map(int, input().split()))
variants = [input() for x in range(n)]
password = input()
print((*list(map(count_time, [lambda x: (len(x), x != password),
                        lambda x: (len(x), x == password)]))))


n, k = list(map(int, input().split()))
s = [input() for i in range(n)]
pas = input()
a = sorted([len(i) for i in s])
f = lambda x: x + ((x - 1) // k) * 5
for i in range(n):
    if a[i] == len(pas):
        L = i + 1
        break
ans1 = f(L)
R = n
for i in range(n):
    if a[i] > len(pas):
        R = i
        break
ans2 = f(R)
print(ans1, ans2)


n,k = (int(i) for i in input().split())
l = []
for i in range(n):
    l += [input()]
ans_pas = input()
low_bow = 0
up_bow = 0
for el in l:
    if len(el) < len(ans_pas):
        low_bow+=1
    elif len(el) == len(ans_pas):
        up_bow+=1
up_bow+=low_bow-1
min_ans = low_bow+(low_bow//k)*5+1
max_ans = up_bow+(up_bow//k)*5+1
print(min_ans,max_ans)

n, k = (int(_) for _ in input().split())
a = []
for i in range(n):
    a.append(input())
pw = input()
x, y = 0, 0
for s in a:
    if s == pw:
        continue
    if len(s) < len(pw):
        x += 1
        y += 1
    if len(s) == len(pw):
        y += 1
x += (x // k) * 5
y += (y // k) * 5
print(x + 1,  y + 1)


n, k = map(int, input().split())
a = []
for i in range(n):
    s = input().rstrip()
    a.append((len(s), s))
s1 = input().rstrip()
a.sort()
time = 0
ans1 = ans2 = 10 ** 13
for i in range(n):
    time += 1        
    if a[i][0] == len(s1):
        ans1 = min(ans1, time)       
    if i == n - 1 or a[i + 1][0] > len(s1):
        ans2 = min(ans2, time)  
    if (i + 1) % k == 0:
        time += 5     
ans2 = min(ans2, time)
print(ans1, ans2)

n, k = map(int, input().split())
a = []
for i in range(n):
    tmp = input()
    a.append((len(tmp), tmp))
a.sort()
ans = input()
ansmin = 10**18
ansmax = 0
nowt = 0
for i in range(n):
    if i % k == 0 and i != 0:
        nowt += 5
    nowt += 1
    if (len(ans) == len(a[i][1])):
        ansmax = nowt
        ansmin = min(ansmin, nowt)
print(ansmin, ansmax)

n, k = map(int, input().split())
dat = [len(input()) for i in range(n)]
p = len(input())
mi = sum(map(lambda x: x < p, dat))
ma = mi + sum(map(lambda x: x == p, dat)) - 1

print(mi + (mi//k)*5 + 1, end = " ")
print(ma + (ma//k)*5 + 1)

# You lost the game.

n,k = map(int, input().split())
S = [str(input()) for _ in range(n)]
p = str(input())

L = [len(S[i]) for i in range(n)]
lp = len(p)

L.sort()
ok = 0
for i in range(n):
    if L[i] == lp and ok == 0:
        ok = 1
        print(i+1+i//k*5,end=" ")
    if L[i] > lp:
        print(i+(i-1)//k*5)
        ok = 2
        break
if ok == 1:
    print(n+(n-1)//k*5)


n,k=tuple(map(int,input().split()))
ls=[set() for i in range(1,110)]
for i in range(n):
	s=input().strip()
	ls[len(s)].add(s)
key=input().strip()
kl=len(key)
kk=0
for i in range(1,kl):
	kk+=len(ls[i])
bt=kk+(kk//k)*5+1
ft=kk+len(ls[kl])+((kk+len(ls[kl])-1)//k)*5
print(bt,ft)


n,k = map(int,input().split())
arr = []
for i in range(n):
    arr.append(input())
corr = input()

least = 0
for x in arr:
    if(len(x)<len(corr)):
        least += 1


lw = 0
for x in arr:
    if(len(x)==len(corr)):
        if(x!=corr):
            lw += 1


print((least//k)*5+least+1,((least+lw)//k)*5+least+lw+1)

n,k=[int(a) for a in input().split()]
p=[]
for i in range(n):
    p.append(input())
real=input()
l=len(real)
cmin,cmax=0,0
for s in p:
    if len(s)<=l:
        cmax=cmax+1
        if len(s)<l:
            cmin=cmin+1

def calc(c):
    if c==0:
        return 0
    return c+5*(c//k)

print(calc(cmin)+1,calc(cmax-1)+1)


parse_int = lambda: list(map(int, input().split()))

n,k = parse_int()

passw = set()
for _ in range(n): passw.add(input().strip())
passw = [len(el) for el in passw]
passw.sort()

tru = len(input().strip())

time = 0
before_shtraf = k
lucky, unlucky = 999999999, 0
for el in passw:
    time += 1

    if el == tru:
        lucky = min(lucky, time)
        unlucky = time

    before_shtraf -= 1
    if before_shtraf <= 0:
        before_shtraf = k
        time += 5

print(lucky, unlucky)

def getin():
    xin = input()
    while xin.strip() == "":
        xin = input()
    return xin

def gi():
    return [int(x) for x in getin().split()]

def count(n, k):
    return int(n/k) * k + int((n - 1)/k) * 5 + n%k

n, k = gi()
m = -1

c = [0] * 109
p = []

for i in range(n):
    s = input()
    c[len(s)] += 1
    if len(s) > m:
        m = len(s)
    p.append(s)

ac = input()

if ac not in p:
    print(count(n, k), count(n, k))
else:
    i = 1
    mi = 0
    while i < len(ac):
        mi += c[i]
        i += 1

    print(count(mi + 1, k), count(mi + c[len(ac)], k))


#!/usr/bin/env python3

n, k = [int(x) for x in input().split()]
passes = [input() for _ in range(n)]
password = input()

l = len([p for p in passes if len(p) < len(password)]) + 1
h = len([p for p in passes if len(p) <= len(password)])

l += ((l-1)//k)*5
h += ((h-1)//k)*5

print(l, h)


n,k=[int(i) for i in input().split()]
ar=[0]*101
for i in range(n):
    ar[len(input())]+=1
tru=len(input())
mn=sum(ar[:tru])
mx=sum(ar[:tru+1])-1
print(mn//k*5+mn+1,mx//k*5+mx+1)


from sys import stdin


n, k = (int(x) for x in stdin.readline().split())

passwords = []

for _ in range(n):
    passwords.append(stdin.readline().strip())

right_password = stdin.readline().strip()

length_less_than_password = len([password for password in passwords if len(password) < len(right_password)])
length_less_than_or_equal_to_password = len([password for password in passwords if len(password) <= len(right_password)])

a = length_less_than_password // k

spent = length_less_than_password + a * 5

print(spent + 1, end=' ')

a = (length_less_than_or_equal_to_password - 1) // k

spent = length_less_than_or_equal_to_password + a * 5

print(spent)


N, K = list(map(int, input().split()))
pwds = [input() for _ in range(N)]
correct = input()
pwds = sorted([pwd for pwd in pwds if len(pwd) <= len(correct)], key=len)
time = 0
count = 0
i = 0
while len(pwds[i]) < len(correct):
    time += 1
    count += 1
    if count == K:
        time += 5
        count = 0
    i += 1
best = time + 1
while i < len(pwds) - 1:
    time += 1
    count += 1
    if count == K:
        time += 5
        count = 0
    i += 1
worst = time + 1
print(str(best) + " " + str(worst))


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

passwords = []

for i in range(0, n):
    passwords.append(len(input()))

correct = len(input())

passwords = sorted(passwords)

t = 0
i = 0

opt, pes = -1, -1

for i in range(0, len(passwords)):
    t += 1
    if passwords[i] == correct:
        pes = t
        if opt == -1:
            opt = t
    if (i + 1) % k == 0:
        t += 5

print(opt, pes)


import sys, re
from itertools import product
from collections import Counter
ls = [l.rstrip() for l in sys.stdin.readlines()]

n, k = list(map(int, ls[0].split(" ")))
pss = ls[1:1+n]
corr = ls[1+n]
a = list([len(x) for x in pss])
m = len(corr)
r1 = 0
for i in range(1, m):
    r1 += a.count(i)
r2 = r1 + a.count(m) - 1
# print(r1, r2)
print(r1//k*5 + r1 + 1, r2//k*5 + r2 + 1)


__author__ = 'Think'
def format(ans):
	return ans+5*(ans//k)
n, k=[int(i) for i in input().split()]
freq={i:0 for i in range(1, 105)}
for i in range(n):
	s=input()
	freq[len(s)]+=1
correct=len(input())
t=0
for i in range(1, correct):
	t+=freq[i]
print(format(t)+1, format(t+freq[correct]-1)+1)