#include <bits/stdc++.h>
using namespace std;
int to_int(string s) { return atoi(s.c_str()); }
int a[100000];
long long int dp[100000];
int main() {
  int m, n;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  if (a[0] % m == 0) {
    dp[0] = 1;
  } else {
    dp[0] = 0;
  }
  long long int sum = a[0];
  for (int i = 1; i < n; i++) {
    sum += a[i];
    long long int tmpsum = sum;
    long long int count = 0;
    if (tmpsum % m == 0) count++;
    for (int j = 0; j < i; j++) {
      tmpsum -= a[j];
      if (tmpsum % m == 0) count++;
    }
    dp[i] = dp[i - 1] + count;
  }
  cout << dp[n - 1] << endl;
}
