#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int sum = 0;
  int c = 0;
  int arr[100005];
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  for (int i = 0; i < n; ++i) {
    sum = arr[i];
    for (int j = i + 1; j < n; ++j) {
      sum = sum + arr[j];
      if (sum < m)
        continue;
      else {
        if (sum % m == 0) c++;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    if (arr[i] < m)
      continue;
    else {
      if (arr[i] % m == 0) {
        c++;
      }
    }
  }
  cout << c;
}
