Harryxun/stf_run huggingface dataset:
n, a = map(int, input().split())
x = list(map(int, input().split()))

dp = [[[0] * 3000 for _ in range(50)] for _ in range(50)]
dp[0][0][0] = 1

for i in range(n):
    for j in range(n):
        for k in range(n * a):
            dp[i + 1][j][k] += dp[i][j][k]
            dp[i + 1][j + 1][k + x[i]] += dp[i][j][k]

ans = 0
for i in range(1, n):
    ans += dp[n][i][a * i]

print(ans)


### FIXED CODE ###

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

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

for i in range(n):
    for use in range(n):
        for total in range(n * a):
            if dp[i][use][total]:
                dp[i + 1][use][total] += dp[i][use][total]
                dp[i + 1][use + 1][total + x[i]] += dp[i][use][total]

ans = 0
for i in range(1, n + 1):
    ans += dp[n][i][a * i]

print(ans)
n,m=map(int,input().split())
s=input()
t=input()

def gcd(x,y):
  r=x%y
  return gcd(y,r) if r else y
#最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

L=lcm(n,m)
if s[0]==t[0]:
  X=[""]*(L*2)
else:
  print(-1)
  exit()
for i in range(1,n):
  X[int(i*L/n)]=s[i]
for i in range(1,m):
  if X[int(i*L/m)] !="":
    if X[int(i*L/m)] !=t[i]:
      print(-1)
      exit()
print(L)

### FIXED CODE ###

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

def gcd(x,y):
  r=x%y
  return gcd(y,r) if r else y
#最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

L=lcm(n,m)
g=gcd(n,m)
for i in range(g):
  if s[int(i*n/g)]!=t[int(i*m/g)]:
    print(-1)
    exit()
print(L)
import numpy as np
H, W, M = map(int, input().split())
HW = [list(map(int, input().split())) for i in range(M)]

grid = np.zeros((H, W))
for h, w in HW:
    grid[h-1][w-1] = 1

max_h = 0
at_h = -1
for h in range(H):
    tmp = np.count_nonzero(grid[h, :])
    if tmp > max_h:
        max_h = tmp
        at_h = h + 1
max_w = 0
at_w = -1
for w in range(W):
    tmp = np.count_nonzero(grid[:, w])
    if tmp > max_w:
        max_w = tmp
        at_w = w + 1

if [at_h, at_w] in HW:
    print(max_h + max_w - 1)
else:
    print(max_h + max_w)

### FIXED CODE ###

H, W, M = map(int, input().split())
HW = [list(map(int, input().split())) for i in range(M)]

g_h = [0] * (H+1)
g_w = [0] * (W+1)

for h, w in HW:
    g_h[h] += 1
    g_w[w] += 1

mxh = max(g_h)
mxw = max(g_w)

cnt = 0
for h, w in HW:
    if g_h[h] == mxh and g_w[w] == mxw:
        cnt += 1
if cnt == g_h.count(mxh) * g_w.count(mxw):
    print(mxh + mxw - 1)
else:
    print(mxh + mxw)
from collections import deque
import copy

def solve(idx, arr, lcur, rcur, isL):
  if len(idx) == len(arr):
    return sum([abs(arr[idx[i]]-arr[idx[i-1]]) for i in range(1, len(idx))])
  else:
    fL = copy.copy(idx)
    fR = copy.copy(idx)
    if isL:
      if lcur <= rcur:
        fL.appendleft(lcur)
        fR.append(lcur)
        lcur += 1
        if lcur <= rcur:
          fL.append(lcur)
          fR.appendleft(lcur)
          lcur += 1
    else:
      if lcur <= rcur:
        fL.appendleft(rcur)
        fR.append(rcur)
        rcur -= 1
        if lcur <= rcur:
          fL.append(rcur)
          fR.appendleft(rcur)
          rcur -= 1
    return max(solve(fL, arr, lcur, rcur, not isL), solve(fR, arr, lcur, rcur, not isL))

N = int(input())
A = sorted([int(input()) for _ in range(N)])
print(solve(deque([0]), A, 1, N-1, False)) 


### FIXED CODE ###

N = int(input())
signs = [1, -1]
coefs = [[-1],[1]]
i = 0
while i < N-2:
  j = 0
  while j < 2:
    coefs[j].append(2*signs[j])
    signs[j] *= -1
    j += 1
  i += 1
coefs[0].append(signs[0])
coefs[1].append(signs[1])
coefs[0].sort()
coefs[1].sort()
A = sorted([int(input()) for _ in range(N)])
print(max([sum([A[i]*coef[i]  for i in range(N)]) for coef in coefs]))
N,M=map(int,input().split())
from collections import defaultdict
branch=defaultdict(set)
for i in range(M):
    a,b=map(int,input().split())
    branch[a]|={b}
    branch[b]|={a}
jisuu=[len(branch[i]) for i in range(N+1)]
print(1)
def dfs1(check,visited,P):
    while len(check)>0:
        now=check.pop()
        for nex in branch[now]:
            if nex not in visited:
                if jisuu[nex]==1:
                    return P[now]+[nex]
                else:
                    check|={nex}
                    visited|={nex}
                    P[nex]=P[now]+[nex]
def dfs2(check,visited,P,goal):
    while len(check)>0:
        now=check.pop()
        for nex in branch[now]:
            if nex not in visited:
                if nex==goal:
                    return P[now]+[nex]
                else:
                    check|={nex}
                    visited|={nex}
                    P[nex]=P[now]+[nex]
if jisuu.count(1)>=2:
    start=jisuu.index(1)
    visited={start}
    check={start}
    P=[0]*(N+1)
    P[start]=[start]
    path=dfs1(check,visited,P)
else:
    for i in range(1,1+N):
        if jisuu[i]==2:
            a,b=list(branch[i])
            if jisuu[a]==2:
                start=i
                goal=a
                nex=b
                break
            elif jisuu[b]==2:
                start=i
                goal=b
                nex=a
                break
    visited={start,nex}
    check={nex}
    P=[0]*(N+1)
    P[start]=[start]
    P[nex]=[start,nex]
    path=dfs2(check,visited,P,goal)
print(len(path))
print(" ".join(map(str,path)))

### FIXED CODE ###

N,M=map(int,input().split())
from collections import deque,defaultdict
branch=defaultdict(set)
for i in range(M):
    a,b=map(int,input().split())
    branch[a-1]|={b-1}
    branch[b-1]|={a-1}
path=deque([0])
for x in branch[0]:
    path.append(x)
    break
used=set(path)
while True:
    A,B=False,False
    if len(branch[path[0]]-used)==0:
        A=True
    else:
        for x in branch[path[0]]:
            if x in used:
                continue
            path.appendleft(x)
            used|={x}
            break
    if len(branch[path[-1]]-used)==0:
        B=True
    else:
        for x in branch[path[-1]]:
            if x in used:
                continue
            path.append(x)
            used|={x}
            break
    if A and B:
        break
path=[p+1 for p in path]
print(len(path))
print(" ".join(map(str,path)))
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
from statistics import median,median_high,median_low
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
n=ii()
if n%2==0:
    print(n//2)
else:
    print((n+1)//2)




### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd

mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
n=ii()
if n%2==0:
    print(n//2)
else:
    print((n+1)//2)
a = input()
a = a.split(" ")
i = 0
while 1:
  if a[0]<0:
    break
  else:
    i = i+1
 	a[0]=a[0]-a[1]
    
print(i)

### FIXED CODE ###

a = input()
a = a.split(" ")
i = 0
while 1:
  if int(a[0]) <= 0:
    break
  else:
    i = i+1
    a[0]=int(a[0])-int(a[1])
    
print(i)
if int(input())==1
	print("Hello World")
else
	print(int(input())+int(input()))

### FIXED CODE ###

if int(input())==1:
	print("Hello World")
else:
	print(int(input())+int(input()))
H,N=map(int,input().split())
A=[]
B=[]
for i in range(N):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)

DP=[10**4+1]*(H+max(A)-1)#DPの箱をH+max(A)-1個用意する

for Ai,Bi in zip(A,B):#すでにあるものを埋める
    DP[Ai-1]=Bi

for dpi in range(H+max(A)-1):
    kouho=DP[dpi]
    for Ai,Bi in zip(A,B):
        if dpi-Ai>=0:
            if kouho>DP[dpi-Ai]+Bi:
                kouho=DP[dpi-Ai]+Bi
    DP[dpi]=kouho


print(min(DP[H:]))

### FIXED CODE ###

h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

max_a = max(a for a, _ in ab)
dp = [0] * (h+max_a)

for i in range(0, h+max_a):
    if i <= 0:
        dp[i] = 0
    else:
        dp[i] = min(dp[i-a] + b for a,b in ab) 

print(min(dp[h:]))
import math
import numpy as np
from functools import reduce

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

D_seq_max = max(D_seq)

judge_list = np.arange(D_seq_max+1)
judge_set = set(judge_list)
D_seq_set = set(D_seq)

N_list = [1]
if((judge_set == D_seq_set)or(D_seq[0]==0)):
    for i in range(D_seq_max):
        N_list.append(D_seq.count(i+1))
    counts = reduce(pow, N_list)
    for i in range(len(N_list)-1):
        counts *= pow(N_list[i], N_list[i+1])
    if(counts < 998244353):    
        print(counts)
    else:
        print(int(counts/998244353))
        
else:
    print(0)

### FIXED CODE ###

import numpy as np
import collections

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

D_seq_max = max(D_seq)

judge_list = np.arange(D_seq_max+1)
judge_set = set(judge_list)
D_seq_set = set(D_seq)

c = collections.Counter(D_seq)

N_list = []
if((judge_set == D_seq_set)and(D_seq[0]==0)):
    if(c[0]>1):
        print(0)
    else:
        counts = 1
        for i in range(D_seq_max):
            counts *= pow(c[i], c[i+1])
        if(counts < 998244353):    
            print(counts)
        else:
            print(int(counts%998244353))
else:
    print(0)
import sys
def dfs(n,c):
    if Ans[n] == -1:
        Ans[n] = c
        for m,w in Data[n]:
            if w % 2 == 0:
                dfs(m,c)
            else:
                dfs(m,1-c)
    elif Ans[n] == c:
        return
    else:
        return

sys.setrecursionlimit(10000)
N = int(input())
Data = []
Ans  = [-1] * N
for i in range(N):
    Data.append([])
for i in range(N-1):
    u,v,w = map(int,input().split())
    Data[u-1].append([v-1,w])
    Data[v-1].append([u-1,w])
dfs(0,0)

for a in Ans:
    print(a)

### FIXED CODE ###

import sys
def dfs(n,c):
    if Ans[n] == -1:
        Ans[n] = c
        for m,w in Data[n]:
            if w % 2 == 0:
                dfs(m,c)
            else:
                dfs(m,1-c)
    elif Ans[n] == c:
        return
    else:
        return

sys.setrecursionlimit(100000)
N = int(input())
Data = []
Ans  = [-1] * N
for i in range(N):
    Data.append([])
for i in range(N-1):
    u,v,w = map(int,input().split())
    Data[u-1].append([v-1,w])
    Data[v-1].append([u-1,w])
dfs(0,0)

for a in Ans:
    print(a)
import math
import sys

N = int(sys.stdin.readline())

queue = [(N, 1)]
blacklist = set()
min_cnt = math.inf

while queue:
    N, cnt = queue.pop()
    if N >= 9:
        v = math.pow(9, math.floor(math.log(N, 9)))
        if N - v >= 6 and cnt < min_cnt:
            queue.append((N - v, cnt + 1))
        elif cnt + (N - v) < min_cnt:
            min_cnt = cnt + int(N - v)
    if N >= 6:
        v = math.pow(6, math.floor(math.log(N, 6)))
        if cnt < min_cnt:
            queue.append((N - v, cnt + 1))
        elif cnt + (N - v) < min_cnt:
            min_cnt = cnt + int(N - v)

if math.isinf(min_cnt):
    print(N)
else:
    print(min_cnt)

### FIXED CODE ###

import itertools
import math
import sys

MAX_N = 100000
MAX_LOG6 = int(math.log(MAX_N, 6))
MAX_LOG9 = int(math.log(MAX_N, 9))

def main(N):
    dp = [MAX_N] * (N + 1)
    for i in range(min(N + 1, 6)):
        dp[i] = i
    for i in range(N + 1):
        t = 1
        for j in range(1, MAX_LOG6 + 1):
            t *= 6
            if i - t < 0:
                break
            dp[i] = min(dp[i], dp[i - t] + 1)
        t = 1
        for j in range(1, MAX_LOG9 + 1):
            t *= 9
            if i - t < 0:
                break
            dp[i] = min(dp[i], dp[i - t] + 1)
    print(dp[N])

if __name__ == '__main__':
    N = int(sys.stdin.readline())
    main(N)
import sys

S = list(map(int,input()))
init = int(len(S))
ans = []

def cube(S):
    if not any(S) or all(S):
        print(int((init-len(S))))
        sys.exit()
    for i in range(len(S)-1):
        if S[i] != S[i+1]:
            cube(S[0:i]+S[i+2:])
cube(S)

### FIXED CODE ###

S = list(map(int,input()))
num1 = 0
num0 = 0

for i in range(len(S)):
    if S[i]:
        num1 += 1
    else:
        num0 += 1

print(min(num1,num0)*2)
n,k = map(int,input().split())

A = list(map(int,input().split()))
sum = 0
import collections

c = collections.Counter(A)
c = c.most_common()
for i in range(n):
  if len(c) > k:
    sum += c[-1][1]
    c = c[:-1]
  else:
    break
print(sum)

### FIXED CODE ###

import sys
import collections
input = sys.stdin.readline
n,k = map(int,input().split())

A = list(map(int,input().split()))
sum = 0
c = collections.Counter(A)
c = c.most_common()
if len(c) > k:
  a = len(c)-k
  c = c[-a:]
  for i in range(a):
    sum += c[i][1]
  print(sum)
else:
  print(0)
from operator import mul
from functools import reduce

def main ():
  count = int(input())
  c = list(map(int,input().split()))
  print(c)

  if 0 in list:
    print(0)

  a = reduce(mul, list)

  if a > 1000000000000000000:
    print(-1)
  else:
    print(a)

main()

### FIXED CODE ###

def main ():
  count = int(input())
  c = list(map(int,input().split()))

  if 0 in c:
    print(0)
    return

  result = 1
  for a in c:
    result *= a
    if result > 1000000000000000000:
      print(-1)
      return

  print(result)

main()
N, W = map(int, input().split())
X = [0] + [-1] * W

for i in range(N):
    w, v = map(int, input().split())
    
    for j in range(W, -1, -1):
        if j + w > W:
            continue
        if X[j] >= 0:
            X[j+w] = max(X[j+w], X[j]+v)

print(max(X))

### FIXED CODE ###

N, W = map(int, input().split())
X = [0] + [-1] * 110000
ma = 0
for i in range(N):
    w, v = map(int, input().split())
    
    for j in range(len(X))[::-1]:
        if X[j] >= 0:
            if X[j] + w <= W:
                if X[j+v] < 0:
                    X[j+v] = X[j]+w
                    ma = max(ma, j+v)
                else:
                    X[j+v] = min(X[j+v], X[j]+w)

print(ma)
X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
#dp問題と予想
ans=0
P=[]
for i in range(X):
    P.append(p[i])
    ans+=p[i]
P.sort()
Q=[]
for i in range(Y):
    Q.append(q[i])
    ans+=q[i]
Q.sort()
rc=0
gc=0
tc=0
fr=False
fg=False
while(1):
    val1=ans
    val2=ans
    if tc>(C-1):
        break
    if rc>(A-1):
        fr=True
    if gc>(B-1):
        fg=True
    if fr and fg:
        break
    if fr:
        b=r[tc]-Q[gc]
        if b<=0:
            break
        val2+=b
        ans=val2
        gc+=1
        tc+=1
        continue
    if gc:
        a=r[tc]-P[rc]
        if a<=0:
            break
        val1+=a
        ans=val1
        rc+=1
        tc+=1
        continue
    a=r[tc]-P[rc]
    b=r[tc]-Q[gc]
    if a<=0 and b<=0:
        break

    val1+=a
    val2+=b
    if val1>val2:
        rc+=1
        tc+=1
        ans=val1
    else:
        gc+=1
        tc+=1
        ans=val2

print(ans)

### FIXED CODE ###

X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
ans=0
P=[]
for i in range(X):
    P.append(p[i])
    #ans+=p[i]
for i in range(Y):
    P.append(q[i])
    #ans+=q[i]
P.sort()
tmp=0
Q=[]
count=0
for i in range(C):
    if count>=(X+Y):
        break
    if r[i]>P[count]:
        Q.append(r[i])
        count+=1
    else:
        break
R=[]
ans=0
for i in range(len(Q)):
    ans+=Q[i]
for i in range(len(Q),X+Y):
    ans+=P[i]
#print(P)
#print(Q)
print(ans)
T = list(map(int, input().split()))
T.sort()
T.reverse()

ope = 0

while T[1]!=T[0]:
    ope += 1
    T[1] += 1
    T[2] += 1
    
while T[2]<T[0]:
    ope += 1
    T[2] += 2

if T[0]==T[2]:
    print(ope)
    
else:print(ope+1)T = list(map(int, input().split()))
T.sort()
T.reverse()

ope = 0

while T[1]!=T[0]:
    ope += 1
    T[1] += 1
    T[2] += 1
    
while T[2]<T[0]:
    ope += 1
    T[2] += 2

if T[0]==T[2]:
    print(ope)
    
else:print(ope+1)

### FIXED CODE ###

T = list(map(int, input().split()))
T.sort()
T.reverse()

ope = 0

while T[1]!=T[0]:
    ope += 1
    T[1] += 1
    T[2] += 1
    
while T[2]<T[0]:
    ope += 1
    T[2] += 2

if T[0]==T[2]:
    print(ope)
    
else:print(ope+1)
# -*- coding:utf-8 -*-
import sys
sys.setrecursionlimit(100000)  # RecursionError対策

"""解説
(1) まず、赤いボールをN-K個一列に並べる

(2) 赤いボールと赤いボールの隙間をi箇所選んで、そこに青いボールをK個置くことを考える

 R R R R R
0 1 2 3 4 5

    この選び方は、(N-K+1)C(i)通り

(3) それぞれの選び方について、青いボールをそれぞれの隙間に何個割り当てるかを考える。
    それぞれ1個以上割り当てる必要があるので、決め方は(K-1)C(i-1)通り。


[入力例1]
B B B R R

・i=1
Bの塊を挿入する位置は、
 R R  |  R R  |  R R
^     |   ^   |     ^
の3通り

で、

Bを分配する場合の数はそれぞれの場合において1通り

よって、3*1 = 3通り


・i=2
 R R  |  R R   |  R R
^ ^   | ^   ^  |   ^ ^
の3通り

で、

Bを分配する場合の数はそれぞれの場合において、

- 少なくとも1個ずつ分配すると、自由におけるBの数は1個
- 2箇所に玉1つを分配する場合の数は
(2)C(1) = 2通り

よって3*2 = 6通り

・i=3
 R R
^ ^ ^
の1通り


[重複組み合わせの考え方]
http://www7b.biglobe.ne.jp/~math-tota/suA/tamahako.htm

B-i個の玉を、区別のできるi個の箱に分ける場合の数みたいな計算をしたい。これは言い換えると、
B-i個の玉と、i-1個の区切りの重複組み合わせ。

・6個の玉を、区別のできる3つの箱に分ける場合の数
6個の玉と、2個のしきりの重複組み合わせ

○○○○|○○| (4,2,0)の場合
|○○|○○○○ (0,2,4)の場合

「8個のオブジェクトのうち、2個を選んでしきりにする」と同じなので、(8)C(2) = 28

"""
from math import factorial

def combination_formula(n, r):
    return factorial(n) // (factorial(r)*factorial(n-r))

def solve():
    N, K = list(map(int, input().split()))
    B, R = K, N-K
    MOD = 10**9+7

    for i in range(1, K+1):
        if R == 0:
            print(1)
            continue
        # R+1から、i個選ぶ
        ans = combination_formula(R+1, i)
        if B-i == 0:
            print(ans%MOD)
            continue
        # B-i個の玉を、区別のできるi個の箱に分ける場合の数みたいな計算をしたい。これは言い換えると、
        # B-i個の玉と、i-1個の区切りの重複組み合わせ。
        ans *= combination_formula(B-i+i-1, i-1)%MOD
        print(ans%MOD)



if __name__ == "__main__":
    solve()


### FIXED CODE ###

# -*- coding:utf-8 -*-
import sys
sys.setrecursionlimit(100000)  # RecursionError対策

"""解説
(1) まず、赤いボールをN-K個一列に並べる

(2) 赤いボールと赤いボールの隙間をi箇所選んで、そこに青いボールをK個置くことを考える

 R R R R R
0 1 2 3 4 5

    この選び方は、(N-K+1)C(i)通り

(3) それぞれの選び方について、青いボールをそれぞれの隙間に何個割り当てるかを考える。
    それぞれ1個以上割り当てる必要があるので、決め方は(K-1)C(i-1)通り。


[入力例1]
B B B R R

・i=1
Bの塊を挿入する位置は、
 R R  |  R R  |  R R
^     |   ^   |     ^
の3通り

で、

Bを分配する場合の数はそれぞれの場合において1通り

よって、3*1 = 3通り


・i=2
 R R  |  R R   |  R R
^ ^   | ^   ^  |   ^ ^
の3通り

で、

Bを分配する場合の数はそれぞれの場合において、

- 少なくとも1個ずつ分配すると、自由におけるBの数は1個
- 2箇所に玉1つを分配する場合の数は
(2)C(1) = 2通り

よって3*2 = 6通り

・i=3
 R R
^ ^ ^
の1通り


[重複組み合わせの考え方]
http://www7b.biglobe.ne.jp/~math-tota/suA/tamahako.htm

B-i個の玉を、区別のできるi個の箱に分ける場合の数みたいな計算をしたい。これは言い換えると、
B-i個の玉と、i-1個の区切りの重複組み合わせ。

・6個の玉を、区別のできる3つの箱に分ける場合の数
6個の玉と、2個のしきりの重複組み合わせ

○○○○|○○| (4,2,0)の場合
|○○|○○○○ (0,2,4)の場合

「8個のオブジェクトのうち、2個を選んでしきりにする」と同じなので、(8)C(2) = 28

"""
from math import factorial

def combination_formula(n, r):
    return factorial(n) // (factorial(r)*factorial(n-r))

def solve():
    N, K = list(map(int, input().split()))
    B, R = K, N-K
    MOD = 10**9+7

    for i in range(1, K+1):
        if R+1-i < 0:
            print(0)
            continue
        
        # R+1から、i個選ぶ
        ans = combination_formula(R+1, i)
        if B-i == 0:
            print(ans%MOD)
            continue
        # B-i個の玉を、区別のできるi個の箱に分ける場合の数みたいな計算をしたい。これは言い換えると、
        # B-i個の玉と、i-1個の区切りの重複組み合わせ。
        if B-i+i-1-(i-1) >= 0:
            ans *= combination_formula(B-i+i-1, i-1)%MOD
        print(ans%MOD)



if __name__ == "__main__":
    solve()
p={2,3};n,c=5,0
while c<int(input()):
  for j in p:
    if n%j==0:break
  else:p.add(n);if n%5==1:print(n,end=" ");cnt+=1
print()

### FIXED CODE ###

print(*[11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,881,911,941,971,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381,1451,1471,1481,1511,1531][:int(input())],sep=" ")
S = input()

if S = 'Sunny':
    print('Cloudy')
elif S = 'Cloudy':
    print('Rainy')
else:
    print('Sunny')

### FIXED CODE ###

S = input()
 
if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
a = input() 
b = input()
return (a * b) + "" + (2 * a + 2 * b)

### FIXED CODE ###

a, b = map(int, raw_input().split())
print a * b, 2 * a + 2 * b
import sys
read = sys.stdin.readline
import time
import math
import itertools as it
def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------

N, K = inpl()
dp = [False] * N
for i in range(K):
    d = inp()
    A = inpl()
    for a in A:
        dp[A-1] = True
cnt = 0
for bl in dp:
    if not bl:
        cnt += 1
print(cnt)

# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)

### FIXED CODE ###

import sys
read = sys.stdin.readline
import time
import math
import itertools as it
def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------

N, K = inpl()
dp = [False] * N
for i in range(K):
    d = inp()
    A = inpl()
    for a in A:
        dp[a-1] = True
cnt = 0
for bl in dp:
    if not bl:
        cnt += 1
print(cnt)

# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)
a="keyence"
s=input()
ans=1
for i in rangn(7):
  m=a[:i]
  n=a[i:]
  m=s.find(m)
  n=s.find(n)
  if m==-1 or n==-1:
    continue
  if n-m>=i:
    ans=0
    break
print("YNeos"[ans::2])

### FIXED CODE ###

a="keyence"
s=input()
ans=1
for i in range(len(s)):
  for j in range(i,len(s)):
    if s[:i]+s[j:]==a:
      ans=0
print("YNEOS"[ans::2])
x = int(input())

if x <10:
  print(x)
elif x<99:
  print(9)
elif x<999:
  print(9+(x-99))
elif x<9999:
  print(909)
elif x<99999:
  print(909+(x-9999))
else:
  print(90909)

### FIXED CODE ###

x = input().split()


d = int(x[2])-(int(x[0])-int(x[1]))

if d>=0:
  print(d)
else:
  print(0)
h,w=map(int,input().split())
a=0
if h=1 or w=1:
	a=1
elif:
	if h%2==1 and w%2==1:
		a=(h*w+1)/2
	else:
		a=h*w/2
print(a)


### FIXED CODE ###

h,w=map(int,input().split())
a=0
if h==1 or w==1:
	a=1
else:
	if h%2==1 and w%2==1:
		a=(h*w+1)//2
	else:
		a=h*w//2
print(a)