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