Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import math

A, B = map(int, input().split())

def gcd(a,b):
	if b == 0:
		return a

	return gcd(b, a%b)


G = gcd(A,B)

sosu = [1]
#d = math.ceil(G**(1/2))
flg = [i for i in range(1, G+1)]


for i in range(2,G+1):
	if flg[i-1] == 0:
		continue
	if G % i == 0:
		sosu.append(i)
		ind = i
		while ind <= G:
			flg[ind-1] = 0
			ind += i


print(len(sosu))

### FIXED CODE ###

import math

A, B = map(int, input().split())

def gcd(a,b):
	if b == 0:
		return a

	return gcd(b, a%b)


G = gcd(A,B)


def sosuhantei(n):
	d = math.floor(n**(1/2))
	cond = True
	for i in range(2,d+1):
		if n % i == 0:
			cond = False
			break
	return cond 


sosu = []
g = math.ceil(G**(1/2)) 

yaku = []

for i in range(1,g+1):
	if G % i == 0:
		yaku.append(i)
		yaku.append(G//i)

yaku = list(set(yaku))

cnt = 0
for i in range(len(yaku)):
	if sosuhantei(yaku[i]):
		cnt += 1

print(cnt)
### BUGGY CODE ###

# -*- coding: utf-8 -*-


def main():
    n, w = map(int, input().split())
    ws = [0 for _ in range(n)]
    vs = [0 for _ in range(n)]
    dp = [[0 for _ in range(w + 1)] for _ in range(n + 1)]

    for i in range(n):
        wi, vi = map(int, input().split())
        ws[i] = wi
        vs[i] = vi

    for i in range(n):
        for sum_w in range(w + 1):
            if sum_w - ws[i] >= 0:
                dp[i + 1][sum_w] = max(dp[i + 1][sum_w],
                                       dp[i][sum_w - ws[i]] + vs[i])

            dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w])

    print(dp[n][w])


if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-


def main():
    n, w = map(int, input().split())
    ws = [0 for _ in range(n)]
    vs = [0 for _ in range(n)]
    dp = [[0 for _ in range(w + 1)] for _ in range(n + 1)]

    for i in range(n):
        wi, vi = map(int, input().split())
        ws[i] = wi
        vs[i] = vi

    for i in range(n):
        for sum_w in range(w + 1):
            if sum_w - ws[i] >= 0:
                dp[i + 1][sum_w] = max(dp[i + 1][sum_w],
                                       dp[i][sum_w - ws[i]] + vs[i])

            dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w])

    print(dp[n][w])


if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10**6)
input = sys.stdin.readline

def main():
    order_F = []
    order_F = input().rstrip().split('T')
    x, y = map(int, input().split())
    distance = [len(i) for i in order_F]
    side = []
    vert = []
    s_append = side.append
    v_append = vert.append
    s_append(distance[0])
    v_append(0)
    for i in range(1, len(distance)):
        if i%2 == 0:
            tmp = [j + distance[i] for j in side]
            for j, value in enumerate(side):
                side[j] = value - distance[i]
            side.extend(tmp)
        else:
            tmp = [j + distance[i] for j in vert]
            for j, value in enumerate(vert):
                vert[j] = value - distance[i]
            vert.extend(tmp)
    if x in side and y in vert:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10**6)
input = sys.stdin.readline

def main():
    order_F = []
    order_F = input().rstrip().split('T')
    x, y = map(int, input().split())
    vert_DP = [False] * 8001
    side_DP = [False] * 8001
    vert_DP[0] = True
    side_DP[0] = True
    vert_sum = 0
    side_sum = 0
    distance = [len(order_F[i]) for i in range(len(order_F))]
    order_len = len(order_F)
    x -= len(order_F[0])
    vert_last = 0
    side_last = 0
    for i in range(1, order_len):
        if i % 2 == 0:
            side_sum += distance[i]
            for j in reversed(range(side_last+1)):
                if side_DP[j]:
                    side_DP[j + distance[i]] = True
            side_last += distance[i]
        else:
            vert_sum += distance[i]
            for j in reversed(range(vert_last+1)):
                if vert_DP[j]:
                    vert_DP[j + distance[i]] = True
            vert_last += distance[i]
    if side_sum < x or vert_sum < y:
        print("No")
    elif (side_sum - x) % 2 == 1 or (vert_sum - y) % 2 == 1:
        print("No")
    else:
        if side_DP[(side_sum - x)//2] and vert_DP[(vert_sum - y)//2]:
            print("Yes")
        else:
            print("No")

if __name__ == "__main__":
    main()
### BUGGY CODE ###

# -*- coding: utf-8 -*-


def main():
    n, k = map(int, input().split())
    h_list = list(map(int, input().split()))

    dp = [0] + [9999999999] * (n - 1)

    for i in range(n):
        for j in range(1, k + 1):
            if i - j >= 0:
                dp[i] = min(dp[i], dp[i - j] + abs(h_list[i] - h_list[i - j]))

    print(dp[-1])


if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-


def main():
    n, k = map(int, input().split())
    h_list = list(map(int, input().split()))

    dp = [0] + [9999999999] * (n - 1)

    for i in range(n):
        for j in range(1, k + 1):
            if i - j >= 0:
                dp[i] = min(dp[i], dp[i - j] + abs(h_list[i] - h_list[i - j]))

    print(dp[-1])


if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline()))
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

s =  sys.stdin.readline().rstrip()
K =  int(sys.stdin.readline())


current = s[0]
cnt = 0
L = []
for stride in range(1, len(s) + 1):
    for i in range(len(s) - stride + 1):
        L.append(s[i:i + stride])

print(sorted(list(set(L)))[K - 1])

### FIXED CODE ###

import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline()))
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

s =  sys.stdin.readline().rstrip()
K =  int(sys.stdin.readline())


current = s[0]
cnt = 0
L = []
for stride in range(1, K + 1):
    for i in range(len(s) - stride + 1):
        L.append(s[i:i + stride])

print(sorted(list(set(L)))[K - 1])
### BUGGY CODE ###

from itertools import groupby
import collections
N=int(input())
a=[input() for i in range(N)]

a = sorted(a)
#print(a)

groups = []
uniquekeys = []
for k, g in groupby(a):
    groups.append(len(list(g)))      # Store group iterator as a list
    uniquekeys.append(k)
#print(max(groups))

for q in range(len(groups)):
  if groups[q] == max(groups):
    print(uniquekeys[q])
    

### FIXED CODE ###

import itertools
from collections import Counter

N=int(input())
a=[input() for i in range(N)]

a = sorted(a)
#print(a)


counter = Counter(a)

mode_v = counter.most_common()[0][-1]
cmc= counter.most_common()
#print(cmc)
it = itertools.takewhile(
    lambda kv: kv[-1] == mode_v, cmc
)

#sorted(it)
f=list(it)
#print(f)
f = sorted(f)
#print(f)
for k in range(len(f)):
	print(f[k][0])
### BUGGY CODE ###

import math
import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))


lcm=[0]*(10**6+5)



for i in range(N):
    a=A[i]
    b=int(math.sqrt(a))+1
    for j in range(2,b):
        temp=0
        while a%j==0:
            a=a//j
            temp+=1
        lcm[j]=max(lcm[j],temp)
        if a==1:
            break
    if a!=1:
        lcm[a]=max(lcm[a],1)
                
        
l=1
for j in range(2,len(lcm)):
    l*=pow(j,lcm[j])
    

ans=0
mod=10**9+7

for i in range(N):
    ans+=l//A[i]
    ans%=mod
    
print(ans%mod)




### FIXED CODE ###

from collections import defaultdict
import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
lcm = defaultdict(int)


for i in range(N):
    a=A[i]
    for j in range(2,a):
        temp=0
        while a%j==0:
            a=a//j
            temp+=1
        lcm[j]=max(lcm[j],temp)
        if a==1 or j*j>A[i]:
            break
    if a!=1:
        lcm[a]=max(lcm[a],1)
                
        
l=1
for d in lcm.items():
    l*=pow(d[0],d[1])
    

ans=0
mod=10**9+7

for i in range(N):
    ans+=l//A[i]
    
print(ans%mod)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
 
ans = 1
for i in range(N):
    ans *= A[i]
if ans > 10 ** 18:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
 
ans = 1
flag = 1
if 0 in A:
    ans = 0
else:
    for i in range(N):
        ans *= A[i]
        if ans > 10 ** 18:
            flag = 0
            break

if flag == 0:
    print(-1)
else:
    print(ans)
### BUGGY CODE ###

N, M = (int(i) for i in input().split()) 

outs = [[] for i in range(N)]
ins = [0] * N


for _ in range(M):
    x, y = (int(i) for i in input().split())
    x -= 1
    y -= 1
    outs[x].append(y)
    ins[y] += 1

q = []
for i in range(N):
    if ins[i] == 0:
        q.append((i,0))

last = [0] * N
while q != []:
    qn, d = q.pop(0)
    ins[qn] -= 1
    if ins[qn] > 0:
        continue
    last[i] = d
    for v in outs[qn]:
        q.append((v, d+1))

print(max(last))
     



### FIXED CODE ###

N, M = (int(i) for i in input().split()) 

outs = [[] for i in range(N)]
ins = [0] * N


for _ in range(M):
    x, y = (int(i) for i in input().split())
    x -= 1
    y -= 1
    outs[x].append(y)
    ins[y] += 1

q = []
for i in range(N):
    if ins[i] == 0:
        q.append(i)

result = []
while q != []:
    qn = q.pop()
    result.append(qn)
    for v in outs[qn]:
        ins[v] -= 1
        if ins[v] == 0:
            q.append(v)


last = [0] * N
# last[i] = iが最後だったときに最長のパス
for sq in result:
    for v in outs[sq]:
        last[v] = max(last[v], last[sq] + 1)

print(max(last))
### BUGGY CODE ###

#!python3.8
# -*- coding: utf-8 -*-
# abc177/abc177_d
import sys
from collections import deque

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

class node:
    def __init__(self, i):
        self.i = i
        self.adj = {self}
        self.visited = False
    
    def join(self, B):
        self.adj.add(B)
        B.adj.add(self)

def bfs(tar):
    q = deque()
    q.append(tar)
    cnt = 0
    while (q):
        tar = q.popleft()
        if not tar.visited:
            cnt += 1
        tar.visited = True
        q.extend(adj for adj in tar.adj if not adj.visited)
    return cnt

def main():
    N, M = i2nn()
    G = [node(i) for i in range(N + 1)]
    for _ in range(M):
        A, B = i2nn()
        G[A].join(G[B])
    ans = 0
    for tar in G[1:]:
        if not tar.visited:
            ans = max(bfs(tar), ans)
    print(ans)
    return

main()


### FIXED CODE ###

#!python3.8
# -*- coding: utf-8 -*-
# abc177/abc177_d
import sys
from collections import deque

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

class node:
    def __init__(self, i):
        self.i = i
        self.adj = {self}
        self.visited = False
    
    def join(self, B):
        self.adj.add(B)
        B.adj.add(self)

def bfs(tar):
    q = deque()
    q.append(tar)
    cnt = 0
    while (q):
        tar = q.popleft()
        if not tar.visited:
            cnt += 1
        tar.visited = True
        q.extend(adj for adj in tar.adj if not adj.visited)
    return cnt

def main():
    N, M = i2nn()
    G = [node(i) for i in range(N + 1)]
    for _ in range(M):
        A, B = i2nn()
        G[A].join(G[B])
    ans = 0
    for tar in G[1:]:
        if not tar.visited:
            ans = max(bfs(tar), ans)
    print(ans)
    return

main()
### BUGGY CODE ###

def main():
    N, K = map(int, input().split())
    A = tuple(map(int, input().split()))
    a = 0
    for j in range(N):
        x = A[j] % K
        if x == 1:
            a += 1
    s = A[0] % K
    for i in range(1, N):
        t = i + 1
        y = (s + A[i]) % K
        if y == t:
            a += 1
        s = y
        s2 = y
        for j in range(1, N-i):
            y = (s2 + A[i+j] - A[j-1]) % K
            if y == t:
                a +=1
            s2 = y
    return a
print(main())


### FIXED CODE ###

def main():
    N, K = map(int,input().split())
    A = list(map(int, input().split()))
    s = 0
    d = {}
    d[0] = {0}
    r = 0
    l = [0] * (N + 1)
    for i, v in enumerate(A, start=1):
        if i - K >= 0:
           x = l[i - K]
           d[x].remove(i-K)
        s += v % K
        s %= K
        t = (s - i) % K
        l[i] = t
        if t in d:
            r += len(d[t])
            d[t].add(i)
        else:
            d[t] = {i}
    return r
print(main())
### BUGGY CODE ###

N = int(input())
a = list(map(float, input().split()))
dp=[[[0.0] *(N+2) for _ in range(N+2)] for _ in range(N+2)]
one,two,three=a.count(1),a.count(2),a.count(3)
for k in range(N+1):
    for j in range(N+1):
        for i in range(N+1):
            if k==0 and j==0 and i==0:
                continue
            num=N
            if i>0:
                num+=dp[i-1][j][k]*i
            if j>0:
                num+=dp[i+1][j-1][k]*j
            if k>0:
                num+=dp[i][j+1][k-1]*k
            dp[i][j][k]=num/(k+j+i)
print(dp[one][two][three])

### FIXED CODE ###

N = int(input())
a = list(map(float, input().split()))
dp=[[[0.0] *(N+2) for _ in range(N+2)] for _ in range(N+2)]
one,two,three=a.count(1),a.count(2),a.count(3)
for k in range(three+1):
    for j in range(two+three+1-k):
        for i in range(N+1):
            if k==0 and j==0 and i==0:
                continue
            num=N
            if i>0:
                num+=dp[i-1][j][k]*i
            if j>0:
                num+=dp[i+1][j-1][k]*j
            if k>0:
                num+=dp[i][j+1][k-1]*k
            dp[i][j][k]=num/(k+j+i)
print(dp[one][two][three])
### BUGGY CODE ###

n=int(input())

for k in range(1,n+1):

    ans=0
    for x in range(1,46):
        if k-x**2<=0:
            break
        for y in range(1,46):
            if k-x**2- y**2<=0:
                break

            for z in range(1,46):
                if x**2 + y**2 + z**2 +x*y + y*z + z*x ==k:
                    ans+=1
                    break


    print(ans)


### FIXED CODE ###

n=int(input())

ans=[0]*(n+1)

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            f= x**2 + y**2 + z**2 + x*y + y*z + z*x
            if f<=n:
                ans[f]+=1

for i in range(1,n+1):
    print(ans[i])
### BUGGY CODE ###

import math
from functools import reduce

K = int(input())

def gcd_list(numbers):
  return reduce(math.gcd, numbers)

output = 0

for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      output += gcd_list([a, b, c])

print(output)

### FIXED CODE ###

import math
from functools import reduce

K = int(input())

def gcd(*numbers):
  return reduce(math.gcd, numbers)

output = 0

for a in range(1, K+1):
  for b in range(a, K+1):
    for c in range(b, K+1):
      if a == b == c:
        output += gcd(a, b, c)
      elif a != b and b != c and c != a:
        output += 6 * gcd(a, b, c)
      else:
        output += 3 * gcd(a, b, c)

print(output)
### BUGGY CODE ###

H, W = map(int, input().split())
c_set = set()
for i in range(H):
  b = input()
  count_b = b.count('#')
  index = 0
  for x in range(count_b):
    index = b.find('#', x)
    c_set.add((i, index))
ans = 0
if len(c_set) != H*W:
  ans += 1
  for i in range(H+W):
    ll = c_set.copy()
    for c in ll:
      if not c[0]-1 < 0:
        c_set.add((c[0]-1, c[1]))
      if not c[0]+1 > W-1:
        c_set.add((c[0]+1, c[1]))
      if not c[1]-1 < 0:
        c_set.add((c[0], c[1]-1))
      if not c[1]+1 > W-1:
        c_set.add((c[0], c[1]+1))
    if len(c_set) >= H*W:
      break;
    else:
      ans += 1
else:
  ans = 0
print(ans)

### FIXED CODE ###

h,w= map(int, input().split())
s_list = []
b_list = []
for i in range(h):
    li = input()
    aa = []
    for j in range(w):
        aa.append(li[j])
        if aa[j] == '#':
            b_list.append((i, j))
    s_list.append(aa)
ans = 0
while True:
    bb_list = []
    for p in b_list:
        pp = [(p[0]-1, p[1]), (p[0]+1, p[1]), (p[0], p[1]-1), (p[0], p[1]+1)]
        for ppp in pp:
            if (0 <= ppp[0] < h) and (0 <= ppp[1] < w):
                if s_list[ppp[0]][ppp[1]] == '.':
                    s_list[ppp[0]][ppp[1]] = '#'
                    bb_list.append((ppp[0], ppp[1]))
    # ここで複数回同じbをやらなくて済むようにしている
    b_list = bb_list
    if len(b_list) == 0:
        break
    ans += 1
    # print(x)
print(ans)
### BUGGY CODE ###


N,W = map(int,input().split())

lis = [ [0] * (W+1) ]


for i in range(N):

    w,v = map(int,input().split())

    new = [0] * (W+1)

    for j in range(W+1):

        new[j] = max(new[j],lis[-1][j])

        if j+w <= W:

            new[j+w] = max(new[j+w],lis[-1][j]+v)

    lis.append(new)

print (lis[-1][W])


### FIXED CODE ###


N,W = map(int,input().split())

lis = [ [0] * (W+1) ]


for i in range(N):

    w,v = map(int,input().split())

    new = [0] * (W+1)

    for j in range(W+1):

        new[j] = max(new[j],lis[-1][j])

        if j+w <= W:

            new[j+w] = max(new[j+w],lis[-1][j]+v)

    lis.append(new)

print (lis[-1][W])
### BUGGY CODE ###

from collections import defaultdict
from collections import deque
dd = defaultdict(list)
pq = defaultdict(int)

N, Q = map(int, input().split())

for _ in range(N-1):
    a,b = map(int, input().split())
    dd[a].append(b)
    dd[b].append(a)

for _ in range(Q):
    p,q = map(int, input().split())
    pq[p] += q
    
answer = [0]*N
queue = deque()
visited = {}
visited[1] = 1
queue.append(1)

while queue != deque():
    tmp = queue.popleft()
    answer[tmp-1] += pq[tmp]
    for i in dd[tmp]:
        if not i in visited:
            visited[i] = 1
            queue.append(i)
            answer[i-1] += answer[tmp-1]
            
print(*answer)



### FIXED CODE ###

def main():
    from collections import defaultdict
    from collections import deque
    import sys
    input = sys.stdin.readline
    dd = defaultdict(list)
    pq = defaultdict(int)

    N, Q = map(int, input().split())

    for _ in range(N-1):
        a,b = map(int, input().split())
        dd[a].append(b)

    for _ in range(Q):
        p,q = map(int, input().split())
        pq[p] += q
    
    answer = [0]*N
    queue = deque()
    queue.append(1)

    while queue != deque():
        tmp = queue.popleft()
        answer[tmp-1] += pq[tmp]
        for i in dd[tmp]:
            queue.append(i)
            answer[i-1] += answer[tmp-1]
            
    print(*answer)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

from math import gcd

n = int(input())

ans =0

for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            g1 = gcd(i,j)
            ans += gcd(g1,k)

print(ans)


### FIXED CODE ###

from math import gcd

n = int(input())

ans =0

for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            g1 = gcd(i,j)
            ans += gcd(g1,k)

print(ans)
### BUGGY CODE ###

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

"""
max_b = max(B)
max_c = max(C)
"""

summs_ab = []
summs = []
for a in A:
    for b in B:
        summs_ab.append(a+b)
summs_ab.sort(reverse=True)
summs_ab = summs_ab[:min(3001, X*Y*Z+1)]

for c in C:
    for sab in summs_ab:
        summs.append(sab+c)
summs.sort(reverse=True)
"""
for a in A[:K]:
    if len(summs) >= K and a + max_b + max_c < summs[K-1]:
        break

    for b in B[:K]:
        if len(summs) >= K and a + b + max_c < summs[K-1]:
            break

        for c in C[:K]:
            summ = a + b + c
            if len(summs) >= K:
                min_sum = summs[K-1]    
                if summ < min_sum:
                    break
            summs.append(summ)
        summs = merge_sort(summs)
        summs.reverse()
"""
for i in range(K):
    print(summs[i])

### FIXED CODE ###

x,y,z,k = map(int,input().split())
lisa = list(map(int,input().split()))
lisb = list(map(int,input().split()))
lisc = list(map(int,input().split()))
lisa.sort(reverse=True)
lisb.sort(reverse=True)
lisc.sort(reverse=True)
an = []
ans = []
for num in lisb:
    for nu in lisa:
        an.append(num+nu)
an.sort(reverse=True)
an = an[:min(3001,x*y*z+1)]
for num in lisc:
    for nu in an:
        ans.append(num+nu)
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])
### BUGGY CODE ###

from collections import deque

def DE(n):
    return float((n+1)*(n/2)/n)

def main():
    N,K = map(int,input().split())
    p = list(map(int,input().split()))
    p = list(map(DE,p))
    ls = deque(p[:K])
    ans = sum(ls)
    for i in range(K,N):
        ls.append(p[i])
        ls.popleft()
        ans = max(ans,sum(ls))
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def DE(n):
    return float((float(n)+1)/2)

def main():
    N,K = map(int,input().split())
    p = list(map(DE,input().split()))
    ans = 0
    tmp = [sum(p[:K])]
    for i in range(K,N):
        tmp.append(tmp[i-K]+p[i]-p[i-K])
    print(max(tmp))

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys
N,M=map(int, input().split())
a=[]
b=[]
c=[]
for m in range (0,M):
  A,B,C=map(int, input().split() )
  a+=[A]
  b+=[B]
  c+=[C]
V=[0]*N# iに到達するときの最大得点
moji=[1]+[0]*(N-1)#infなら0をかえす
 
for n in range(N-1):
  for m in range(M):
    u=a[m]
    v=b[m]
    if moji[a[m]-1]:#共に有限の時はやる
      if moji[b[m]-1]:
        V[b[m]-1]=max(V[b[m]-1],V[a[m]-1]+c[m])
      else:
        V[b[m]-1]=V[a[m]-1]+c[m]
        moji[b[m]-1]=1

W=V[:]
for n in range(N-1):
  for m in range(M):
    u=a[m]
    v=b[m]
    if moji[a[m]-1]:#共に有限の時はやる
      if moji[b[m]-1]:
        W[b[m]-1]=max(W[b[m]-1],W[a[m]-1]+c[m])
      else:
        W[b[m]-1]=W[a[m]-1]+c[m]
        moji[b[m]-1]=1
if V[N-1]==W[N-1]:
  print(V[N-1])
else:
  print("inf")

### FIXED CODE ###

import sys
N,M=map(int, input().split())
a=[]
b=[]
c=[]
for m in range (0,M):
  A,B,C=map(int, input().split() )
  a+=[A]
  b+=[B]
  c+=[C]
V=[0]+[-10**12]*(N-1)# iに到達するときの最大得点
 
for n in range(N-1):
  for m in range(M):
    u=a[m]
    v=b[m]
    if V[b[m]-1]<V[a[m]-1]+c[m]:#共に有限の時はやる
      V[b[m]-1]=V[a[m]-1]+c[m]
 
moji2=[0]*N
for n in range(N):
  for m in range(M):
    u=a[m]
    v=b[m]
    if V[b[m]-1]<V[a[m]-1]+c[m]:#共に有限の時はやる
      V[b[m]-1]=V[a[m]-1]+c[m]
      moji2[b[m]-1]=1
      if moji2[N-1]:
        print("inf")
        sys.exit()
print(V[N-1])