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