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