#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, m;
  cin >> n >> m;
  vector<unsigned long long> a(n + 1);
  a[0] = 0;
  for (long i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  long long result = 0;
  for (long i = 1; i <= n; i++)
    for (long j = i; j <= n; j++)
      if ((a[j] - a[i - 1]) % m == 0) result++;
  printf("%lld", result);
  return 0;
}
