#include "iostream"
#include "map"

using namespace std;

int main(){
int n,mod;
cin>>n>>mod;
long long int v[100001]={};
map<int,long long int>m;
m[0]++;
for(int i=1;i<=n;i++){
cin>>v[i];
v[i]+=v[i-1];
v[i]%=mod;
m[v[i]]++;
}
long long int ans=0;
for(auto i:m)ans+=i.second*(i.second-1)/2;
cout<<ans<<endl;
}