/**
 *      ABC 105 D
 *      author  : kyomukyomupurin
 *      created : 2018-09-16 19:53:32
**/

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    ll N, M; cin >> N >> M;
    ll A[N] = {};
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    ll s[N + 1]; s[0] = 0;
    for (int i = 1; i <= N; ++i) {
        s[i] = A[i - 1] + s[i - 1];
    }

    ll count = 0;

    for (int i = 0; i < N; ++i) {
        for (int j = i + 1; j < N + 1; ++j) {
            if ((s[j] - s[i]) % M == 0){
                ++count; //cout << s[j] << " " << s[i] << endl;
            }        
        }    
    }
    cout << count << endl;

    return 0;

}