https://www.acwing.com/problem/content/1232/
#include<bits/stdc++.h>
using namespace std;
const int N=100010;
int n,k;
int d[N];
long long int a[N];
long long int ans;
int main(){
cin>>n>>k;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
for(int i=1;i<=n;i++){
a[i]+=a[i-1];
// printf("ans=%d a[i]=%d a[i-1]=%d i=%d d=%d\n",ans,a[i],a[i-1],i,d[a[i-1]%k]);
ans+=d[a[i]%k];
d[a[i]%k]++;
}
cout<<ans<<endl;
return 0;
}