#d1201. 摘桃子

摘桃子

Picking Peaches

Problem Description

There are nn people picking peaches in an orchard. The nn people stand in a line, and from left to right the number of peaches each person has is aia_i.

The orchard has a free-peach rule: if the total number of peaches held by xx consecutive people, divided by kk, leaves a remainder exactly equal to xx, then those xx people can get peaches for free. Moreover, there is only one chance per day to get peaches for free.

Figure out how many different ways there are for someone to get peaches for free today.

Input Format

The first line contains two integers nn and kk.

The next line contains nn integers a1,a2,…,ana_1, a_2, \dots, a_n.

Output Format

One integer: the answer.

Sample Input

8 4
4 2 4 2 4 2 4 2

Sample Output

7

Sample Explanation

The seven different schemes are: a1,a2a_1, a_2; a2,a3a_2, a_3; a3,a4a_3, a_4; a4,a5a_4, a_5; a5,a6a_5, a_6; a6,a7a_6, a_7; a7,a8a_7, a_8.

Note: two schemes are different as long as at least one boundary of the contiguous segment differs.

Constraints

For all data, 1≤n≤2×1051 \le n \le 2 \times 10^5, 1≤k≤1091 \le k \le 10^9, 1≤ai≤1091 \le a_i \le 10^9.