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

s=input()
k=int(input())

se=set()
for i in range(97,123):
    for j in range(len(s)):
        if s[j]==chr(i):
            for l in range(j+1,len(s)+1):
                se.add(s[j:l])
    if len(se)>=k:
            break
    
se=sorted(se)

print(se[k-1])

### FIXED CODE ###

s=input()
kk=int(input())

dic={}
for i in range(len(s)):
    dic[s[i]]=1
    
dic=sorted(dic,key=lambda x:x[0])
check=0
se=set()
for i in dic:
    for j in range(len(s)):
        if s[j]!=i:
            continue
        k=j+1
        se.add(i)
        sss=i
        while k<len(s):
            sss+=s[k]
            se.add(sss)
            k+=1
            if k-j>kk:
                break
    if len(se)>=kk:
        break
se=sorted(list(se))
print(se[kk-1])
### BUGGY CODE ###

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

cnt = 0
for i in range(N):
    if P[i] == min(P[:i+1]):
        cnt += 1

print(cnt)


### FIXED CODE ###

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

min_value = P[0]
cnt = 1
for i in range(1, N):
    if P[i] < min_value :
        min_value = P[i]
        cnt += 1

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

n = int(input())
A = [int(x) for x in input().split()]
A1 = [A[2*i] for i in range(int(n/2))]
A2 = [A[2*i+1] for i in range(int(n/2))]
A1_count = [A1.count(A1[i]) for i in range(len(A1))]
A2_count = [A2.count(A2[i]) for i in range(len(A2))]
x= len(A1)+len(A2) - max(A1_count) -max(A2_count)
if (len(A1)==max(A1_count)) and (len(A2) == max(A2_count)) and (A1[0] == A2[0]):
  print(len(A1))
else:
  print(x)

### FIXED CODE ###

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

S0 = {}
S1 = {}
for i in range(len(S)):
  if i%2 == 0:
    if S[i] not in S0:
      S0[S[i]] =1
    else:
      S0[S[i]] += 1
  else:
    if S[i] not in S1:
      S1[S[i]] =1
    else:
      S1[S[i]] += 1

if max(S0, key = S0.get) != max(S1, key = S1.get):
  Answer = len(S) - max(S0.values()) -max(S1.values())
  print(Answer)
  exit()
      
S0list = sorted(list(S0.values()),reverse = True)
S1list = sorted(list(S1.values()),reverse = True)

S00 = S0list[0]

if len(S0list) == 1:
  S01 = 0
else:
  S01 = S0list[1]
S10 = S1list[0]
if len(S1list) == 1:
  S11 = 0
else:
  S11 = S1list[1]
Answer = min(len(S) - S00 - S11,len(S) - S01 - S10)

print(Answer)
### BUGGY CODE ###

line = input()
data = line.split()
import math
import itertools
out =0
pair =list(itertools.combinations_with_replacement(range(0,int(data[0])+1), 3))


for i in range(len(pair)):
  if sum(pair[i]) == int(data[1]):
    clear_data =list(pair[i])
    if clear_data[0] <=int(data[0]) or clear_data[1] <=int(data[0]) or clear_data[2] <=int(data[0]):
      if clear_data[0] ==clear_data[1] and clear_data[0] ==clear_data[2] and clear_data[1] ==clear_data[2]:
        out +=1
      elif clear_data[0] !=clear_data[1] and clear_data[0] !=clear_data[2] and clear_data[1] !=clear_data[2]:
        out +=6
      else:
        out +=3

print(out)


### FIXED CODE ###

line = input().split()
k =int(line[0])
s =int(line[1])
data =[0,0,0]
out =0

for i in range(k+1):
  for t in range(i,1+k):
    data[0] =i
    data[1] =t
    data[2] =s-data[1]-data[0]
    
    if data[2] >=0 and data[2] <=k and data[2]>=t :
     
      if data[0] ==data[1] and data[0] ==data[2] and data[1] ==data[2]:
        out +=1
      elif data[0] !=data[1] and data[0] !=data[2] and data[1] !=data[2]:
        out +=6
      else:
        out +=3
print(out)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**8)
n,w=map(int,input().split())
l=[[]]
for i in range(n):
  l.append(list(map(int,input().split())))
dp=[[-1 for i in range(w+1)] for j in range(n+1)]
def knap(x,y):
  if x==n+1:
    return 0
  if dp[x][y]!=-1:
    return dp[x][y]
  elif y<l[x][0]:
    res=knap(x+1,y)
  else:
    res=max(knap(x+1,y),knap(x+1,y-l[x][0])+l[x][1])
  dp[x][y]=res
  return res
knap(1,w)
print(dp[1][w])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
def knapsack(N,W,weight,value):
  #初期化
  inf=float("inf")
  dp=[[-inf for i in range(W+1)] for j in range(N+1)]
  for i in range(W+1): dp[0][i]=0

  #DP
  for i in range(N):
    for w in range(W+1):
      if weight[i]<=w: #dp[i][w-weight[i]の状態にi番目の荷物が入る可能性がある
        dp[i+1][w]=max(dp[i][w-weight[i]]+value[i], dp[i][w])
      else: #入る可能性はない
        dp[i+1][w]=dp[i][w]
  return dp[N][W]
n1,w1=map(int,input().split())
lw=[]
lv=[]
for i in range(n1):
  w,v=map(int,input().split())
  lw.append(w)
  lv.append(v)
print(knapsack(n1,w1,lw,lv))
### BUGGY CODE ###

n = int(input())
s = input()

c = 0
for i in range(n):
    for j in range(i + 1, n):
        if s[i] != s[j]:
            for k in range(j + 1, n):
                if j - i == k - j:
                    continue
                if s[i] != s[k] and s[j] != s[k]:
                    c += 1
print(c)

### FIXED CODE ###

n = int(input())
S = input()

R = {}
G = {}
B = {}

for i in range(n):
    if S[i] == 'R':
        R[i] = None
    elif S[i] == 'G':
        G[i] = None
    else:
        B[i] = None

#print(R, G, B)

cnt = 0

cnt = len(R) * len(G) * len(B)

for b in B:
    for g in G:
        if (b + g) / 2 in R:
            cnt -= 1

for r in R:
    for b in B:
        if (r + b) / 2 in G:
            cnt -= 1

for r in R:
    for g in G:
        if (r + g) / 2 in B:
            cnt -= 1
            
print(cnt)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(X, N: int, M: int, Q: int, L: "List[int]", R: "List[int]", p: "List[int]", q: "List[int]"):
    C = [[0 for _ in range(509)] for _ in range(509)]
    for i in range(1, N+1):
        for j in range(1, N+1):
            C[i][j] = C[i][j-1] + X[i][j]
    for i in range(Q):
        su = 0
        for j in range(p[i], q[i]+1):
            su += C[j][q[i]] - C[j][p[i]-1]
        print(su)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    L = [int()] * (M)  # type: "List[int]" 
    R = [int()] * (M)  # type: "List[int]" 
    X = [[0 for _ in range(509)] for _ in range(509)]
    for i in range(M):
        L[i] = int(next(tokens))
        R[i] = int(next(tokens))
        X[L[i]][R[i]] += 1
    p = [int()] * (Q)  # type: "List[int]" 
    q = [int()] * (Q)  # type: "List[int]" 
    for i in range(Q):
        p[i] = int(next(tokens))
        q[i] = int(next(tokens))
    solve(X, N, M, Q, L, R, p, q)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(X, N: int, M: int, Q: int, L: "List[int]", R: "List[int]", p: "List[int]", q: "List[int]"):
    C = [[0 for _ in range(509)] for _ in range(509)]
    for i in range(1, N+1):
        for j in range(1, N+1):
            C[i][j] = C[i][j-1] + X[i][j]
    for i in range(Q):
        su = 0
        for j in range(p[i], q[i]+1):
            su += C[j][q[i]] - C[j][p[i]-1]
        print(su)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    L = [int()] * (M)  # type: "List[int]" 
    R = [int()] * (M)  # type: "List[int]" 
    X = [[0 for _ in range(509)] for _ in range(509)]
    for i in range(M):
        L[i] = int(next(tokens))
        R[i] = int(next(tokens))
        X[L[i]][R[i]] += 1
    p = [int()] * (Q)  # type: "List[int]" 
    q = [int()] * (Q)  # type: "List[int]" 
    for i in range(Q):
        p[i] = int(next(tokens))
        q[i] = int(next(tokens))
    solve(X, N, M, Q, L, R, p, q)

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

import sys
sys.setrecursionlimit(10**6)

n,m = map(int,input().split())

global clasta
clasta = [-1 for i in range(n)]
path = [[] for i in range(n)]
for _ in range(m):
    x,y,z = map(int,input().split())
    path[x-1].append(y-1)
    path[y-1].append(x-1)

def dfs(now,color):
    for y in path[now]:
        if clasta[y] == -1:
            clasta[y] = color
            dfs(y,color)

for idx,i in enumerate(clasta):
    if i == -1:
        clasta[idx] = idx
        dfs(idx,idx)

print(len(set(clasta)))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
        
        
n,m = map(int,input().split())

uf = UnionFind(n)
for _ in range(m):
    x,y,z = map(int,input().split())
    uf.union(x-1, y-1)
    
print(uf.group_count())
### BUGGY CODE ###

N,M = map(int,input().split())
S = input()
T = input()

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

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

X = ["" for i in range(lcm(N,M))]
L = len(X)
flag = True

for i in range(N):
  X[(i+1-1)*int(L/N)] = S[i]

for i in range(M):
  if X[(i+1-1)*int(L/M)] == "":
    X[(i+1-1)*int(L/M)] = T[i]
  else:
    if X[(i+1-1)*int(L/M)] == T[i]:
      continue
    else:
      flag = False
      break
      
if flag:  
  print(L)
else:
  print(-1)


### FIXED CODE ###

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return int(a)
    r = a % b
    return gcd(b, r)

def lcm(a,b):
  return int(a*b/gcd(a,b))
 
N,M = map(int,input().split())
S = input()
T = input()
L = lcm(N,M)
flag = True
min_len = min(N,M)
s_index = int(int(L/M)/gcd(int(L/M),int(L/N)))
t_index = int(int(L/N)/gcd(int(L/M),int(L/N)))

if N == M:
  for i in range(N):
    if S[i] == T[i]:
      continue
    else:
      flag = False
      break
else:
  for i in range(min_len):
    if i * s_index < N-1 and i*t_index < M - 1:
      if S[i*s_index] == T[i*t_index]:
        continue
      else:
        flag = False
        break
    else:
      break
    
if flag:  
  print(L)
else:
  print(-1)
### BUGGY CODE ###

# "#"=black, "."=white
import copy

H, W = map(int, input().split())
HW = []
for i in range(H):
  HW.append(list(input()))
# print(HW)

def whiteCount(HWlist):
  return [flatten for inner in HWlist for flatten in inner].count(".")    

pHW = copy.deepcopy(HW)
turnCnt=0
while(whiteCount(HW)):
  for i in range(H):
    for j in range(W):
      if HW[i][j] == "#":
        if i > 0:
          pHW[i-1][j] = "#"
        if i < H-1:
          pHW[i+1][j] = "#"
        if j > 0:
          pHW[i][j-1] = "#"
        if j < W-1:
          pHW[i][j+1] = "#"
  turnCnt += 1
  HW = copy.deepcopy(pHW)
  # print(pHW)
print(turnCnt)


### FIXED CODE ###

from collections import deque
h, w = map(int, input().split())

field = [] # 白黒情報を持つリスト
mark = [] # 操作回数を保持するリスト
INF = 10**6

for i in range(h):
    field.append(list(input()))
    mark.append([0 for i in range(w)])

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

queue = deque()
for i in range(h):
    for j in range(w):
        if field[i][j] == "#":
            queue.append([i, j])

while len(queue) > 0:
    y, x = queue.popleft()
    for k in range(4):
        nx = x + dx[k]
        ny = y + dy[k]
        if 0 <= ny < h and 0 <= nx < w:
            if field[ny][nx] == ".":
                mark[ny][nx] = mark[y][x] + 1
                queue.append([ny, nx])
                field[ny][nx] = "#"

ans=0

for i in mark:
    ans = max(ans, max(i))

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

N=int(input())
A=list(map(int, input().split()))
for i in range(N):
  print(A.count(i+1))

### FIXED CODE ###

N=int(input())
A=list(map(int, input().split()))
ans=list([0]*N)
for i in range(N-1):
  tmp=A[i]
  ans[tmp - 1]+=1
for i in range(N):
  print(ans[i])
### BUGGY CODE ###

#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
B.sort()
C.sort()

import bisect
A2 = []
B2 = []
C2 = []
for a,b,c in zip(A,B,C):
    bisect.insort_left(A2, a)
    bisect.insort_left(B2, b)
    bisect.insort_left(C2, c)
# print(A,B,C)
# import numpy as np

sum = 0
for b in B:
    sum += bisect.bisect_left(A2, b) * (N - bisect.bisect_right(C2, b))

# for c in C:
#     for b in [x for x in B if x < c]:
#         for a in [x for x in A if x < b]:

print(sum)

### FIXED CODE ###

#!/mnt/c/Users/moiki/bash/env/bin/python
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
B.sort()
C.sort()

import bisect
A2 = []
B2 = []
C2 = []
# for a,b,c in zip(A,B,C):
#     bisect.insort_left(A2, a)
#     # bisect.insort_left(B2, b)
#     bisect.insort_left(C2, c)
# print(A,B,C)
# import numpy as np

sum = 0
for b in B:
    sum += bisect.bisect_left(A, b) * (N - bisect.bisect_right(C, b))

# for c in C:
#     for b in [x for x in B if x < c]:
#         for a in [x for x in A if x < b]:

print(sum)
### BUGGY CODE ###

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

for x in range(0 , K):
    if (A >= 1):
        A = A - 1
        #print(A)
    elif (A == 0) and (B >= 1):
        B = B - 1
        #print(B)

print(A, B)

### FIXED CODE ###

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

if (K > A + B):
    print(0, 0)
elif (K <= A):
    print(A - K, B)
elif (K > A):
    print(0, max(0, B - (K - A)))
### BUGGY CODE ###

N,K = map(int,input().split())
from collections import deque

#期待値はΣ(from 1 to pi)/len(pi)
P = list(map(int,input().split()))

que = deque(P[:K])
counter = []
counter.append(sum(que))
for k in range(K,N):
    que.popleft()
    que.append(P[k])
    counter.append(sum(que))

print((max(counter)+K)/2)


### FIXED CODE ###

N,K = map(int,input().split())
#from collections import deque

#期待値はΣ(from 1 to pi)/len(pi)
P = list(map(int,input().split()))
cumsum = [0]*(N+1)
counter = []
for k in range(N):
    cumsum[k+1]=cumsum[k]+P[k]

for i in range(N-K+1):
    counter.append(cumsum[i+K]-cumsum[i])

print((max(counter)+K)/2)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n,k = map(int,input().split())
edge = [[] for i in range(n)]
alledge = []
for i in range(n-1):
    a,b = map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
    alledge.append((a-1,b-1))

def f(x,y,c):
    global tmp
    c += 1
    for e in edge[x]:
        if e == y:
            continue
        if c > d:
            tmp +=1
        f(e,x,c)

sys.setrecursionlimit(4100000)

if k % 2 == 0:
    d = k//2
    ass = 2001
    for i in range(n):
        tmp = 0
        f(i,-1,0)
        ass = min(ass,tmp)
    print(ass)
else:
    d = (k-1)//2
    ass = 2001
    for e1 in alledge:
        tmp = 0
        f(e1[0],e1[1],0)
        f(e1[1],e1[0],0)
        ass = min(ass,tmp)
    print(ass)


### FIXED CODE ###

import sys
#input = sys.stdin.readline
n,k = map(int,input().split())
edge = [[] for i in range(n)]
alledge = []
for i in range(n-1):
    a,b = map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
    alledge.append((a-1,b-1))

def f(x,y,c):
    global tmp
    c += 1
    for e in edge[x]:
        if e == y:
            continue
        if c > d:
            tmp +=1
        f(e,x,c)

sys.setrecursionlimit(4100000)

if k % 2 == 0:
    d = k//2
    ass = 2001
    for i in range(n):
        tmp = 0
        f(i,-1,0)
        ass = min(ass,tmp)
    print(ass)
else:
    d = (k-1)//2
    ass = 2001
    for e1 in alledge:
        tmp = 0
        f(e1[0],e1[1],0)
        f(e1[1],e1[0],0)
        ass = min(ass,tmp)
    print(ass)
### BUGGY CODE ###

S = input()
N = len(S)

ans=0
for i in range(N-3):
    for j in range(i+4, N+1):
        if int(S[i:j])%2019 == 0:
            ans+=1
print(ans)


### FIXED CODE ###

S = list(input())
N = len(S)

ans = 0
cnt = [0] * 2019
a = 1
s = 0

for i in range(N)[::-1]:
    s = int(S[i]) * a + s
    a *= 10
    a = a % 2019
    cnt[s % 2019] += 1
    s = s % 2019

ans += cnt[0]
for i in range(2019):
    ans += cnt[i] * (cnt[i] - 1) // 2
print(ans)
### BUGGY CODE ###

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


def kitaichi(num):
    return (sum(range(num+1)) / num)


tmp = 0
tmp_i = 0
for i in range(n-k+1):
    a = sum([p[x] for x in range(i, i+k)])
    if a > tmp:
        tmp = a
        tmp_i = i

ans = [kitaichi(p[tmp_i+x]) for x in range(k)]
print(sum(ans))

### FIXED CODE ###

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


t = [0] * (n+k+1)
for i in range(n):
    t[i+1] = t[i] + p[i]

ans = 0
for i in range(n):
    ans = max(ans, t[i+k]-t[i])
print((ans+k)/2)
### BUGGY CODE ###

def main():
    n,k = map(int,input().split())
    hts = list(map(int,input().split()))
    
    dp = [float('inf')]*n
    dp[0] = 0
    dp[1] = abs(hts[1]-hts[0])

    for i in range(2,min(k,n)):
        ans = dp[i]
        for j in range(i,0,-1):
            ans = min(ans,dp[i-j]+abs(hts[i]-hts[i-j]))

        dp[i] = ans

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

        dp[i] = ans

    #print(dp)

    print(dp[-1])

main()


### FIXED CODE ###

def main():
    n,k = map(int,input().split())
    hts = list(map(int,input().split()))
    
    dp = [float('inf')]*n
    dp[0] = 0
    dp[1] = abs(hts[1]-hts[0])

    for i in range(2,min(k,n)):
        ans = dp[i]
        for j in range(i,0,-1):
            ans = min(ans,dp[i-j]+abs(hts[i]-hts[i-j]))

        dp[i] = ans

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

        dp[i] = ans

    #print(dp)

    print(dp[-1])

main()
### BUGGY CODE ###

#!/usr/bin/env python3

def main():
    N = int(input())
    *P, = map(int, input().split())

    cnt = 0
    for i in range(0, N):
        if P[i] == min(P[0:i + 1]):
            cnt += 1
    print(cnt)


main()

### FIXED CODE ###

#!/usr/bin/env python3

def main():
    N = int(input())
    *P, = map(int, input().split())

    mini = 10**6
    cnt = 0
    for _ in P:
        if _ < mini:
            mini = _
            cnt += 1
        else:
            continue
    print(cnt)


main()
### BUGGY CODE ###

def primes(n):
    sieve = [True] * n
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i]:
            sieve[i * i::2 * i] = [False] * (int((n - i * i - 1) / (2 * i)) + 1)
    return [2] + [i for i in range(3, n, 2) if sieve[i]]


def isprime(n):
    if n == 1:
        return False
    i = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += 1
    return True


q = int(input())
array = [[int(x) for x in input().split()] for y in range(q)]


res = 0
for i in array:
    res = 0
    for j in range(i[0], i[1]+1, 2):
        if isprime(j) and isprime((j+1)//2):
            res += 1
    print(res)


### FIXED CODE ###

import math
import bisect


def is_prime(x):
    if x < 2: return False # 2未満に素数はない
    if x == 2 or x == 3 or x == 5: return True # 2,3,5は素数
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False # 2,3,5の倍数は合成数

    # ためし割り: 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True


if __name__ == '__main__':
    q = int(input())
    array = [[int(x) for x in input().split()] for x in range(q)]
    nearby_2017 = [x for x in range(1, 100000, 2) if is_prime(x) and is_prime((x+1)/2)]
    for i, j in array:
        print(bisect.bisect_right(nearby_2017, j) - bisect.bisect_left(nearby_2017, i))
### BUGGY CODE ###

import sys

# import bisect
# from collections import Counter, deque, defaultdict
# import copy
# from heapq import heappush, heappop, heapify
# from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter

# import math

# from numba import jit

# from scipy import
# import numpy as np
# import networkx as nx

# import matplotlib.pyplot as plt

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, s = list(map(int, readline().split()))
    a = list(map(int, readline().split()))

    dp = [[0] * 6001 for _ in range(n + 1)]

    for ai in range(n):
        w = a[ai]
        dp[ai][0] += 1

        for si in range(s + 1):
            dp[ai + 1][si] += dp[ai][si]
            dp[ai + 1][si + w] += dp[ai][si]

    ans = 0
    for ai in range(n+1):
        ans += dp[ai][s]

    print(ans % 998244353)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

readline = sys.stdin.readline
MOD = 998244353
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, s = map(int, readline().split())
    a = list(map(int, readline().split()))
    dp = [[0] * (s + 1) for _ in range(n + 1)]
    dp[0][0] = 1

    for i in range(n):
        cur = a[i]
        dp[i + 1][0] += 1
        for j in range(s + 1):
            dp[i + 1][j] += dp[i][j]
            dp[i + 1][j] %= MOD
            nx = cur + j
            if nx <= s:
                dp[i + 1][nx] += dp[i][j]
                dp[i + 1][nx] %= MOD
    ans = 0

    for i in range(1, n + 1):
        ans += dp[i][s]
        ans %= MOD

    print(ans)


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

def f(n, p, a):
    if n == 1:
        if p == 0 and a[0] % 2 == 0:
            print(2)
        elif p == 0 and a[0] % 2 == 1:
            print(1)
        elif p == 1 and a[0] % 2 == 0:
            print(0)
        elif p == 1 and a[0] % 2 == 1:
            print(1)
    else:
        import itertools
        bin = list(itertools.product([0, 1], repeat=n))
        count = 0
        for i in bin:
            total = sum([a[j] for j in i if j == 1])
            if total % 2 == p:
                count += 1
        print(count)

n, p = map(int, input().split())
a = list(map(int, input().split()))
f(n, p, a)



### FIXED CODE ###

# AGC017A

def f(n, p, a):
    odd = sum(i % 2 for i in a)
    if odd == 0:
        if p == 0:
            return 2**n
        elif p == 1:
            return 0
    else:
        return 2**(n-1)
        
n, p = map(int, input().split())
a = list(map(int, input().split()))
print(f(n, p, a))