[伯俊]近損失


メソッド:シーケンス、Brootforce
変数を宣言するときは、グローバル変数とゾーン変数の区別に注意してください.
# -*- coding: utf-8 -*-
import sys
from itertools import permutations

N, K = map(int, sys.stdin.readline().strip().split())
kit_list = list(map(int, sys.stdin.readline().strip().split()))

per_list = list(permutations(range(len(kit_list)), N))

total_cnt = len(per_list)
fail_cnt = 0

for per in per_list:
    W = 500
    for p in per:
        if W + kit_list[p] - K < 500:
            fail_cnt += 1
            break
        else:
            W = W + kit_list[p] - K
    

print(total_cnt - fail_cnt)