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

int main () {
  int N;
  long long M;
  cin >> N >> M;
  int A[N];
  long long S[N][N];
  for(int i = 1; i <= N ;i++){
  	scanf(%f,A[i]);
  }
  for(int j = 1;j <= N;j++){
    S[j][j] = A[j];
   for(int i = j + 1;i <= N ;i++){
  	S[j][i] = S[j][i-1] + A[i];
   }
  }
  long long cnt = 0;
  for(int j = 1;j <= N;j++){
   for(int i = j;i <= N ;i++){
     if(S[j][i] % M == 0){
       //cout << j << "," << i << endl;
       cnt++;
     }
   }
  }
  cout << cnt << endl;
 return 0;
}