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