#include <bits/stdc++.h>
using namespace std;
long long n, m, x, s[100001];
int main() {
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) cin >> x, s[i] = s[i - 1] + x;
  x = 0;
  for (long long i = 0; i < n; i++)
    for (long long j = i + 1; j <= n; j++)
      if ((s[j] - s[i]) % m == 0) x++;
  cout << x;
  return 0;
}
