#include <bits/stdc++.h>
using namespace std;

#define LL long long int
#define LD long double
#define inp_s ios::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define mod 1000000007

int main(){
      LL n, a[100010], p[100010], m;
      cin >> n >> m;
      for(int i=1 ; i<=n ; i++){
            cin >> a[i];
            p[i] += (p[i-1] + a[i]) % m;
      }
      map<LL, LL> M;
      M[0LL]++;
      LL ans = 0LL;
      for(int i=1 ; i<=n ; i++){
     
            ans += M[p[i]];
            M[r]++;
      }
      cout <<  ans << '\n';
      return 0;
}