#include "bits/stdc++.h"

typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define REP(i,n) for (int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
 
using namespace std;

signed main(){
    
    int  n,m;
    cin >> n >> m;

    int s[n+1] = {0};
    REP(i,n){
        int a;
        cin >> a;
        s[i+1] = s[i] + a;
    }

    int ans = 0;
    for(int i = 0;i <= n-1 ; i++){
        for(int j = i+1;j<=n;j++){
            if((s[j]-s[i])%m == 0)ans++;
        }
    }

    cout << ans << endl;
    
    return 0;
}
//g++ -std=c++14 code1.cpp
