#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long a[100001];
int main() {
  cin >> n >> m;
  cin >> a[0];
  for (int i = 1; i < n; ++i) {
    long long b;
    scanf("%lld", &b);
    a[i] = a[i - 1] + b;
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] % m == 0) ++ans;
  }
  for (int i = 1; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      if ((a[j] - a[i - 1]) % m == 0) ++ans;
    }
  }
  cout << ans << endl;
}
