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