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