#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
constexpr int64_t MOD = 1'000'000'007;

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

    vector< vector<int64_t> > p(N, vector<int64_t>(N));
    for(int l=0; l<N; l++) {
        p[l][l] = A[l];
        for(int r=l+1; r<N; r++) {
            p[l][r] = p[l][r-1] + A[r];
        }
    }

    int64_t ans = 0;
    for(int l=0; l<N; l++) {
        for(int r=l; r<N; r++) {
            if(p[l][r]%M == 0) {
                ans++;
            }
        }
    }

    cout << ans << endl;
    return 0;
}
