include[HTML_REMOVED]
typedef long long ll;
const int N=100010;
int s[N],cnt[N],a[N];
int n,k;
ll ans=0;
using namespace std;
int main(){
cin>>n>>k;
for(int i=1;i<=n;i){
cin>>a[i];
s[i]=(s[i-1]+a[i])%k;
ans+=cnt[s[i]];
cnt[s[i]];
}
cout<<ans+cnt[0];
return 0;
}