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