N = 1000
M = 300
NM = N + M
newArr = sum((arr[i * NM:(i + 1) * NM - M] for i in range(ceil(len(arr) / NM))), [])
import math
import itertools
data_for_test = list(range(1, 31))
ALL_MASK_VALS = 10
TRUE_MASK_VALS = 3
MASK_LEN = math.ceil(len(data_for_test)/ALL_MASK_VALS)
mask = (1 if i < TRUE_MASK_VALS else 0 for _ in range(MASK_LEN) for i in range(ALL_MASK_VALS))
result = list(itertools.compress(data_for_test, mask))
>>> result
[1, 2, 3, 11, 12, 13, 21, 22, 23]