#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, M;
  cin >> N >> M;
  long long a[100010];
  for (int i = 0; i < N; ++i) cin >> a[i];
  long long count = 0;
  long long sumA[100010];
  sumA[0] = a[0];
  for (int i = 1; i < N; ++i) sumA[i] = sumA[i - 1] + a[i];
  for (int i = 0; i < N; ++i) {
    for (int j = i; j < N; ++j) {
      if (i == 0) {
        if (sumA[j] % M == 0) count++;
      } else {
        if ((sumA[j] - sumA[i - 1]) % M == 0) count++;
      }
    }
  }
  cout << count << endl;
}
