#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
const long long int INF = (long long int)1e15;
long long int A[100005];
long long int S[100005];
long long int ans[100005];
int main() {
  long long int N, M;
  cin >> N >> M;
  for (long long int i = (long long int)(0); i < (long long int)(N); ++i) {
    cin >> A[i];
  }
  for (long long int i = (long long int)(0); i < (long long int)(N); ++i) {
    S[i] = A[i];
    if (i > 0) {
      S[i] += S[i - 1];
    }
  }
  for (long long int i = (long long int)(0); i < (long long int)(N); ++i) {
    for (long long int j = (long long int)(i); j >= 0; --j) {
      if ((S[i] - S[j] + A[j]) % M == 0) {
        if (j > 0) {
          ans[i] = ans[j - 1];
        }
        ans[i]++;
        break;
      }
    }
  }
  long long int sum = 0;
  for (long long int i = (long long int)(0); i < (long long int)(N); ++i) {
    sum += ans[i];
  }
  cout << sum << endl;
  return 0;
}
