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