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