include<iostream>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

int main(int argc,char** argv){
  int N,M;
  cin >> N >> M;
  int a[N];
  for(int i = 0; i<N;i++){
    cin >> a[i];
  }
  long ans = 0;
  for(int i = 0; i < N; i++){
    int tmp = 0;
    for(int j = i; j < N; j++){
      tmp += a[j];
      if(tmp % M == 0){
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
