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