#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int sum = 0;
  int N;
  int M;
  long long int box[1000000];
  long long int a = 0;
  cin >> N >> M;
  int b;
  box[0] = 0;
  for (int i = 0; i < N; i++) {
    cin >> b;
    a += b;
    box[i + 1] = a;
  }
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N + 1; j++) {
      if ((box[j] - box[i]) % M == 0) {
        sum++;
      }
    }
  }
  cout << sum << endl;
  return 0;
}
