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