import re import sys content = input() pattern = r'^(\d+) (\d+)$' result = re.match(pattern, content) if not result: sys.exit("format error.") N, K = map(int, content.split()) if not (1 <= N and N <= 10**5): sys.exit("N") if not (2 <= K and K <= 100): sys.exit("K") content = input() pattern = r'^(-?\d+)( (-?\d+))*$' result = re.match(pattern, content) if not result: sys.exit("format error.") A = list(map(int, content.split())) if len(A) != N: sys.exit("A") sum = 0 for i in range(N): if not (1 <= A[i] and A[i] <= 10**5): sys.exit("A[i]") sum += A[i] if not (K <= sum and sum <= 10**5): sys.exit("sum")