#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1e5 + 7;
const int Inf = 1e9 + 7;
long long N, M;
long long A[Maxn], sum[Maxn];
int main() {
  while (cin >> N >> M) {
    memset(sum, 0LL, sizeof(sum));
    ;
    long long ans = 0;
    for (int i = 1; i <= N; i++) {
      scanf(" %I64d", &A[i]);
      if (A[i] % M == 0) ans++;
      if (i == 1)
        sum[i] = A[i];
      else
        sum[i] = sum[i - 1] + A[i];
    }
    sum[0] = 0;
    long long num = 0;
    for (int i = 1; i <= N; i++) {
      if (sum[N] - sum[i - 1] < M) continue;
      for (int j = N; j >= i + 1; j--) {
        if (sum[j] - sum[i - 1] < M) break;
        if ((sum[j] - sum[i - 1]) % M == 0) ans++;
      }
    }
    cout << ans << endl;
  }
}
